Lee-W commented on code in PR #36586:
URL: https://github.com/apache/airflow/pull/36586#discussion_r1458113287


##########
airflow/providers/amazon/aws/hooks/redshift_data.py:
##########
@@ -201,3 +216,54 @@ def get_table_primary_key(
                 break
 
         return pk_columns or None
+
+    async def check_query_is_finished_async(
+        self, statement_id: str, poll_interval: int = 10
+    ) -> dict[str, str]:
+        """Async function to check statement is finished.
+
+        It takes statement_id, makes async connection to redshift data to get 
the query status
+        by statement_id and returns the query status.
+
+        :param statement_id: the UUID of the statement
+        :param poll_interval: how often in seconds to check the query status
+        """
+        try:
+            while await self.is_still_running(statement_id):
+                await asyncio.sleep(poll_interval)
+
+            resp = await self.async_conn.describe_statement(Id=statement_id)
+            status = resp["Status"]

Review Comment:
   all thanks to your kind suggestion and thoughtful review 🙂



-- 
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: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to