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:
[email protected]


With regards,
Apache Git Services

Reply via email to