shivaam commented on code in PR #62227:
URL: https://github.com/apache/airflow/pull/62227#discussion_r2841985959


##########
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:
   It checks for both optional and required params.
   
   
   
https://github.com/apache/airflow/blob/a7cbd42137f5f0a061dcf868cc143272f2985f95/providers/amazon/tests/unit/amazon/aws/hooks/test_hooks_signature.py#L106-L113
   
   I also ran the test just to make sure
   ```
    * 'airflow.providers.amazon.aws.hooks.athena_sql.AthenaSQLHook' allowed 
only 'athena_conn_id' additional attributes,
    *  but got extra parameters 'region_name', 'verify', 'config', 
'resource_type', 'aws_conn_id', 'client_type'. Please move additional 
attributes from class constructor into method signatures.
    * 
    ```



-- 
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]

Reply via email to