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 2021/11/17 03:08:56 UTC

[GitHub] [airflow] dstandish commented on a change in pull request #18431: Add hook_kwargs to SqlSensor.

dstandish commented on a change in pull request #18431:
URL: https://github.com/apache/airflow/pull/18431#discussion_r750848153



##########
File path: airflow/sensors/sql.py
##########
@@ -58,39 +62,35 @@ class SqlSensor(BaseSensorOperator):
     ui_color = '#7c7287'
 
     def __init__(
-        self, *, conn_id, sql, parameters=None, success=None, failure=None, fail_on_empty=False, **kwargs
+        self,
+        *,
+        conn_id,
+        sql,
+        parameters=None,
+        success=None,
+        failure=None,
+        fail_on_empty=False,
+        hook_kwargs=None,
+        **kwargs
     ):
         self.conn_id = conn_id
         self.sql = sql
         self.parameters = parameters
         self.success = success
         self.failure = failure
         self.fail_on_empty = fail_on_empty
+        self.hook_kwargs = hook_kwargs
         super().__init__(**kwargs)
 
     def _get_hook(self):
         conn = BaseHook.get_connection(self.conn_id)
-
-        allowed_conn_type = {
-            'google_cloud_platform',
-            'jdbc',
-            'mssql',
-            'mysql',
-            'odbc',
-            'oracle',
-            'postgres',
-            'presto',
-            'snowflake',
-            'sqlite',
-            'trino',
-            'vertica',
-        }
-        if conn.conn_type not in allowed_conn_type:
+        hook = conn.get_hook(hook_kwargs=self.hook_kwargs)
+        if not isinstance(hook, DbApiHook):

Review comment:
       Why are you making this change in a PR that purports only to add `hook_kwargs` to `SqlSensor`? 




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