sidshas03 commented on code in PR #55694:
URL: https://github.com/apache/airflow/pull/55694#discussion_r2356095170
##########
providers/amazon/src/airflow/providers/amazon/aws/hooks/athena_sql.py:
##########
@@ -65,8 +65,41 @@ class AthenaSQLHook(AwsBaseHook, DbApiHook):
hook_name = "Amazon Athena"
supports_autocommit = True
- def __init__(self, athena_conn_id: str = default_conn_name, *args,
**kwargs) -> None:
- super().__init__(*args, **kwargs)
+ def __init__(
+ self,
+ athena_conn_id: str | None = None, # keep positional compatibility
Review Comment:
Thanks! I’ll change the signature to
This keeps positional/keyword compatibility without extra fallback code.
I’ll run `prek` and push.
> `athena_conn_id: str = default_conn_name`.
##########
providers/amazon/src/airflow/providers/amazon/aws/hooks/athena_sql.py:
##########
@@ -65,8 +65,41 @@ class AthenaSQLHook(AwsBaseHook, DbApiHook):
hook_name = "Amazon Athena"
supports_autocommit = True
- def __init__(self, athena_conn_id: str = default_conn_name, *args,
**kwargs) -> None:
- super().__init__(*args, **kwargs)
+ def __init__(
+ self,
+ athena_conn_id: str | None = None, # keep positional compatibility
+ *,
+ s3_staging_dir: str | None = None,
+ work_group: str | None = None,
+ driver: str | None = None,
+ aws_domain: str | None = None,
+ session_kwargs: dict | None = None,
+ config_kwargs: dict | None = None,
+ role_arn: str | None = None,
+ assume_role_method: str | None = None,
+ assume_role_kwargs: dict | None = None,
+ aws_session_token: str | None = None,
+ endpoint_url: str | None = None,
+ **kwargs,
+ ) -> None:
+ # prefer explicit arg; fall back to kwargs; finally default
+ if athena_conn_id is None:
+ athena_conn_id = kwargs.pop("athena_conn_id",
self.default_conn_name)
+ else:
+ kwargs.pop("athena_conn_id", None) # avoid conflicts
Review Comment:
Agreed. With the default in the signature, the `kwargs.pop("athena_conn_id",
…)` block isn’t needed. I’ll remove lines 85–89 and set `self.athena_conn_id =
athena_conn_id` directly. No behavior change elsewhere.
--
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]