This is an automated email from the ASF dual-hosted git repository.
husseinawala pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new a9132f3891 Move RDS hook to a cached property in RDS trigger (#35990)
a9132f3891 is described below
commit a9132f389163ec6adcf6187def521e04a25685da
Author: Hussein Awala <[email protected]>
AuthorDate: Fri Dec 1 00:11:49 2023 +0200
Move RDS hook to a cached property in RDS trigger (#35990)
---
airflow/providers/amazon/aws/triggers/rds.py | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/airflow/providers/amazon/aws/triggers/rds.py
b/airflow/providers/amazon/aws/triggers/rds.py
index 78a6dfa16a..5d5bd5e6e0 100644
--- a/airflow/providers/amazon/aws/triggers/rds.py
+++ b/airflow/providers/amazon/aws/triggers/rds.py
@@ -17,6 +17,7 @@
from __future__ import annotations
import warnings
+from functools import cached_property
from typing import TYPE_CHECKING, Any
from airflow.exceptions import AirflowProviderDeprecationWarning
@@ -83,8 +84,11 @@ class RdsDbInstanceTrigger(BaseTrigger):
},
)
+ @cached_property
+ def hook(self) -> RdsHook:
+ return RdsHook(aws_conn_id=self.aws_conn_id,
region_name=self.region_name)
+
async def run(self):
- self.hook = RdsHook(aws_conn_id=self.aws_conn_id,
region_name=self.region_name)
async with self.hook.async_conn as client:
waiter = client.get_waiter(self.waiter_name)
await async_wait(