shivaam commented on code in PR #62227:
URL: https://github.com/apache/airflow/pull/62227#discussion_r2836805730
##########
providers/amazon/src/airflow/providers/amazon/aws/hooks/athena_sql.py:
##########
@@ -70,7 +70,13 @@ class AthenaSQLHook(AwsBaseHook, DbApiHook):
supports_autocommit = True
def __init__(self, athena_conn_id: str = default_conn_name, *args,
**kwargs) -> None:
- super().__init__(*args, **kwargs)
+ # AwsGenericHook.__init__() only accepts these kwargs. Connection
extras
+ # like s3_staging_dir and work_group are not constructor params — they
are
+ # read later from the connection in get_conn().
BaseSQLOperator.get_hook()
+ # passes all connection extras as kwargs, so we must filter them out
here.
+ _aws_generic_hook_kwargs = {"aws_conn_id", "verify", "region_name",
"client_type", "resource_type", "config"}
+ filtered_kwargs = {k: v for k, v in kwargs.items() if k in
_aws_generic_hook_kwargs}
Review Comment:
So the project convention suggests that we should keep the aws hook to be
thin wrappers. Looking at the tests, AthenaSQLHook only allows athena_conn_id
in the list available in the unit tests
https://github.com/apache/airflow/blob/a7cbd42137f5f0a061dcf868cc143272f2985f95/providers/amazon/tests/unit/amazon/aws/hooks/test_hooks_signature.py#L145-L154
https://github.com/apache/airflow/blob/a7cbd42137f5f0a061dcf868cc143272f2985f95/providers/amazon/tests/unit/amazon/aws/hooks/test_hooks_signature.py#L28-L34
--
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]