Vamsi-klu commented on code in PR #68527:
URL: https://github.com/apache/airflow/pull/68527#discussion_r3410092440
##########
providers/databricks/src/airflow/providers/databricks/hooks/databricks_base.py:
##########
@@ -233,6 +238,47 @@ def _get_connection_attr(self, attr_name: str) -> str:
raise ValueError(f"`{attr_name}` must be present in Connection")
return attr
+ @cached_property
+ def proxies(self) -> dict[str, str] | None:
+ """Return validated proxy configuration from connection extras."""
+ extra_dejson = self.databricks_conn.extra_dejson
Review Comment:
Thanks — I made proxy parsing fail-fast and deterministic by validating
`extra_dejson` type, `proxies` shape, and values with explicit
`DatabricksProxyConfigurationError` messages that include concrete runtime type
details for malformed inputs.\n\n---\nDrafted-by: Codex (no human review before
posting)
##########
providers/databricks/src/airflow/providers/databricks/hooks/databricks_base.py:
##########
@@ -445,7 +495,9 @@ def _get_aad_token_for_default_az_credential(self,
resource: str) -> str:
#
# While there is a WorkloadIdentityCredential class, the
below class is advised by Microsoft
#
https://learn.microsoft.com/en-us/azure/aks/workload-identity-overview
- token =
DefaultAzureCredential().get_token(f"{resource}/.default")
+ token =
DefaultAzureCredential(**self._get_azure_credential_kwargs()).get_token(
Review Comment:
Thanks — I updated both sync and async default Azure credential paths to use
helper-based class/kwargs construction, and added tests that assert proxy
kwargs are passed when configured and filtered safely when unsupported
constructor params are encountered.\n\n---\nDrafted-by: Codex (no human review
before posting)
##########
providers/databricks/src/airflow/providers/databricks/hooks/databricks_base.py:
##########
@@ -233,6 +238,47 @@ def _get_connection_attr(self, attr_name: str) -> str:
raise ValueError(f"`{attr_name}` must be present in Connection")
return attr
+ @cached_property
+ def proxies(self) -> dict[str, str] | None:
+ """Return validated proxy configuration from connection extras."""
+ extra_dejson = self.databricks_conn.extra_dejson
+ if not isinstance(extra_dejson, dict):
+ return None
+
+ proxies = extra_dejson.get("proxies")
+ if proxies is None:
+ return None
+ if not isinstance(proxies, dict):
+ raise DatabricksProxyConfigurationError("Connection extra
'proxies' must be a JSON object.")
+
+ invalid_keys = set(proxies) - {"http", "https"}
+ if invalid_keys:
+ invalid_keys_str = ", ".join(sorted(invalid_keys))
+ raise DatabricksProxyConfigurationError(
+ f"Connection extra 'proxies' only supports 'http' and 'https'
keys. Got: {invalid_keys_str}."
+ )
+
+ for proxy_scheme, proxy_url in proxies.items():
Review Comment:
Thanks — I updated regression coverage so `http` and `https` are both
supported: sync requests forward full proxy mapping, and async requests resolve
the scheme-specific proxy via URL scheme before passing it to the request
call.\n\n---\nDrafted-by: Codex (no human review before posting)
--
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]