utkarsharma2 commented on code in PR #31596:
URL: https://github.com/apache/airflow/pull/31596#discussion_r1233490069


##########
airflow/providers/snowflake/hooks/snowflake_sql_api.py:
##########
@@ -254,3 +246,30 @@ def get_sql_api_query_status(self, query_id: str) -> 
dict[str, str | list[str]]:
             }
         else:
             return {"status": "error", "message": resp["message"]}
+
+    def get_sql_api_query_status(self, query_id: str) -> dict[str, str | 
list[str]]:
+        """
+        Based on the query id async HTTP request is made to snowflake SQL API 
and return response.
+
+        :param query_id: statement handle id for the individual statements.
+        """
+        self.log.info("Retrieving status for query id %s", query_id)
+        header, params, url = self.get_request_url_header_params(query_id)
+        response = requests.get(url, params=params, headers=header)
+        status_code = response.status_code
+        resp = response.json()
+        return self._process_response(status_code, resp)
+
+    async def get_sql_api_query_status_async(self, query_id: str) -> dict[str, 
str | list[str]]:
+        """
+        Based on the query id async HTTP request is made to snowflake SQL API 
and return response.
+
+        :param query_id: statement handle id for the individual statements.
+        """
+        self.log.info("Retrieving status for query id %s", {query_id})
+        header, params, url = self.get_request_url_header_params(query_id)
+        async with aiohttp.ClientSession(headers=header) as session:
+            async with session.get(url, params=params) as response:
+                status_code = response.status
+                resp = await response.json()
+                return self._process_response(status_code, resp)

Review Comment:
   @uranusjr I'm not sure I understand you completely, but based on what I got. 
The function `get_sql_api_query_status_async` is called indirectly when we are 
polling for the status of the query within triggered. So deferring it would not 
be ideal, right?



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