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 06:32:17 UTC

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

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


##########
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 need for this any more... the next release of provider has minimum version of 2.3 for all providers.



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