kaxil commented on a change in pull request #10025:
URL: https://github.com/apache/airflow/pull/10025#discussion_r462553886
##########
File path: airflow/providers/amazon/aws/sensors/athena.py
##########
@@ -71,8 +72,6 @@ def poke(self, context):
return False
return True
- def get_hook(self):
+ def get_hook(self) -> AWSAthenaHook:
"""Create and return an AWSAthenaHook"""
- if not self.hook:
- self.hook = AWSAthenaHook(self.aws_conn_id, self.sleep_time)
- return self.hook
Review comment:
We need to keep it as it is. If Hook has already been created, we just
want to return it instead of creating a new one.
##########
File path: airflow/providers/amazon/aws/sensors/athena.py
##########
@@ -71,8 +72,6 @@ def poke(self, context):
return False
return True
- def get_hook(self):
+ def get_hook(self) -> AWSAthenaHook:
Review comment:
Or you could try the following:
```suggestion
@cached_property
def hook(self) -> AWSAthenaHook:
```
If you do this, you don't need to have `self.hook` in the __init__
----------------------------------------------------------------
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]