vincbeck commented on code in PR #30501:
URL: https://github.com/apache/airflow/pull/30501#discussion_r1162936762


##########
airflow/providers/amazon/aws/transfers/dynamodb_to_s3.py:
##########
@@ -118,11 +125,77 @@ def __init__(
         self.dynamodb_scan_kwargs = dynamodb_scan_kwargs
         self.s3_bucket_name = s3_bucket_name
         self.s3_key_prefix = s3_key_prefix
+        self.export_time = export_time
+        self.export_format = export_format
 
-    def execute(self, context: Context) -> None:
-        hook = DynamoDBHook(aws_conn_id=self.source_aws_conn_id)
-        table = hook.get_conn().Table(self.dynamodb_table_name)
+    @cached_property
+    def hook(self):
+        """Create DynamoDBHook"""
+        return DynamoDBHook(aws_conn_id=self.source_aws_conn_id)
 
+    def execute(self, context: Context) -> None:
+        if self.export_time:
+            self._export_table_to_point_in_time()
+        else:
+            self._export_entire_data()
+
+    def _create_or_get_waiter(self):
+        """Create or get a waiter"""
+        if CUSTOM_WAITER_NAME in self.hook.list_waiters():
+            return self.hook.get_waiter(CUSTOM_WAITER_NAME)
+        else:
+            with open(self.hook.waiter_path, "r+") as config_file:
+                model_config = json.load(config_file)

Review Comment:
   The waiter config is better to be defined in a json file 
[here](https://github.com/apache/airflow/tree/main/airflow/providers/amazon/aws/waiters).
 You can take a look at this [PR](https://github.com/apache/airflow/pull/29761) 
as example on how to create and use these custom waiters. I hope it helps!



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to