potix2 commented on a change in pull request #9246:
URL: https://github.com/apache/airflow/pull/9246#discussion_r509556649



##########
File path: airflow/providers/amazon/aws/transfers/s3_to_redshift.py
##########
@@ -87,29 +93,35 @@ def __init__(
         self.verify = verify
         self.copy_options = copy_options or []
         self.autocommit = autocommit
+        self.truncate_table = truncate_table
+        self._s3_hook = None
+        self._postgres_hook = None
 
-    def execute(self, context) -> None:
-        postgres_hook = PostgresHook(postgres_conn_id=self.redshift_conn_id)
-        s3_hook = S3Hook(aws_conn_id=self.aws_conn_id, verify=self.verify)
-        credentials = s3_hook.get_credentials()
+    def execute(self, context):
+        self._postgres_hook = 
PostgresHook(postgres_conn_id=self.redshift_conn_id)

Review comment:
       IMHO, it's better to keep these hooks as local variables because you get 
type error from mypy and the narrow scope is better.




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


Reply via email to