You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/02/19 09:53:44 UTC

[GitHub] [airflow] ashb edited a comment on issue #7441: [AIRFLOW-6822] AWS hooks should cache boto3 client

ashb edited a comment on issue #7441: [AIRFLOW-6822] AWS hooks should cache boto3 client
URL: https://github.com/apache/airflow/pull/7441#issuecomment-588131525
 
 
   To duplicate my comments from the Jira issue. I feel we could do this nicer with a lot less duplication:
   
   In AwsHook:
   ```
   from cached_property import cached_property
   
       @cached_property
       def conn(self):
           return self.get_client_type(self.client_type, region=self.region_name)
   
       def get_conn(self):
           # Compat shim
           return self.conn
   ```
   
   And then in each subclass we only need to define:
   
   ```
   class S3Hook(AwsHook):
       client_type = "S3"
   ```
   
   for instance.
   
   The lambda hook would need a custom property as it takes an extra arg, but the others wouldn't.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services