You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/10/26 23:23:01 UTC

[GitHub] [airflow] potiuk commented on a diff in pull request #26944: Use DbApiHook.run for DbApiHook.get_records and DbApiHook.get_first

potiuk commented on code in PR #26944:
URL: https://github.com/apache/airflow/pull/26944#discussion_r1006267713


##########
airflow/providers/common/sql/hooks/sql.py:
##########
@@ -38,6 +41,35 @@ def fetch_all_handler(cursor) -> list[tuple] | None:
         return None
 
 
+def fetch_one_handler(cursor) -> list[tuple] | None:
+    """Handler for DbApiHook.run() to return results"""
+    if cursor.description is not None:
+        return cursor.fetchone()
+    else:
+        return None
+
+
+def _backported_get_hook(connection, *, hook_params=None):
+    """Return hook based on conn_type
+    For supporting Airflow versions < 2.3, we backport "get_hook()" method. This should be removed
+    when "apache-airflow-providers-slack" will depend on Airflow >= 2.3.

Review Comment:
   No particular reason. Just a mistake :) . I think it would be great to add it :)



-- 
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-unsubscribe@airflow.apache.org

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