karunpoudel commented on code in PR #57184:
URL: https://github.com/apache/airflow/pull/57184#discussion_r2461129391
##########
providers/postgres/src/airflow/providers/postgres/hooks/postgres.py:
##########
@@ -522,19 +522,17 @@ def get_azure_iam_token(self, conn: Connection) ->
tuple[str, str, int]:
azure_conn = Connection.get(azure_conn_id)
except AttributeError:
azure_conn = Connection.get_connection_from_secrets(azure_conn_id)
# type: ignore[attr-defined]
- azure_base_hook: AzureBaseHook = azure_conn.get_hook()
- scope = conf.get("postgres", "azure_oauth_scope",
fallback=self.default_azure_oauth_scope)
try:
- token = azure_base_hook.get_token(scope).token
- except AttributeError as e:
- if e.name == "get_token" and e.obj == azure_base_hook:
- raise AttributeError(
- "'AzureBaseHook' object has no attribute 'get_token'. "
- "Please upgrade
apache-airflow-providers-microsoft-azure>=12.8.0",
- name=e.name,
- obj=e.obj,
+ azure_base_hook: AzureBaseHook = azure_conn.get_hook()
+ except TypeError as e:
+ if "required positional argument: 'sdk_client'" in str(e):
+ raise TypeError(
+ "Getting azure token is not supported by current version
of 'AzureBaseHook'. "
+ "Please upgrade
apache-airflow-providers-microsoft-azure>=12.8.0"
) from e
raise
+ scope = conf.get("postgres", "azure_oauth_scope",
fallback=self.default_azure_oauth_scope)
+ token = azure_base_hook.get_token(scope).token
Review Comment:
Config section is different. It's `snowflake` in snowflake provider and
`postgres` in postgres provider. Azure oauth scope value is generally different
for postgres and snowflake.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]