andreahlert commented on code in PR #62867:
URL: https://github.com/apache/airflow/pull/62867#discussion_r2920542488
##########
providers/common/sql/src/airflow/providers/common/sql/datafusion/engine.py:
##########
@@ -158,6 +158,49 @@ def _fetch_extra_configs(keys: list[str]) -> dict[str,
Any]:
credentials = self._remove_none_values(credentials)
extra_config = _fetch_extra_configs(["region", "endpoint"])
+ case "google_cloud_platform":
+ try:
+ from airflow.providers.google.common.hooks.base_google
import GoogleBaseHook
+ except ImportError:
+ from airflow.providers.common.compat.sdk import
AirflowOptionalProviderFeatureException
+
+ raise AirflowOptionalProviderFeatureException(
+ "Failed to import GoogleBaseHook. To use the GCS
storage functionality, please install the "
+ "apache-airflow-providers-google package."
+ )
+ gcp_hook: GoogleBaseHook =
GoogleBaseHook(gcp_conn_id=conn.conn_id)
+ key_path = gcp_hook._get_field("key_path")
+ if key_path:
+ credentials.update({"service_account_path": key_path})
+ extra_config = {}
+
+ case "wasb":
+ try:
+ from airflow.providers.microsoft.azure.hooks.wasb import
WasbHook # noqa: F401
+ except ImportError:
+ from airflow.providers.common.compat.sdk import
AirflowOptionalProviderFeatureException
+
+ raise AirflowOptionalProviderFeatureException(
+ "Failed to import WasbHook. To use the Azure storage
functionality, please install the "
+ "apache-airflow-providers-microsoft-azure package."
+ )
+ account_name = conn.host or conn.login
+ tenant_id = conn.extra_dejson.get("tenant_id")
+ if tenant_id:
+ credentials = {
+ "account": account_name,
+ "client_id": conn.extra_dejson.get("client_id") or
conn.login,
+ "client_secret":
conn.extra_dejson.get("client_secret") or conn.password,
+ "tenant_id": tenant_id,
+ }
Review Comment:
Fair enough, makes sense given how WasbHook is structured. Thanks for
clarifying.
--
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]