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`?
The description should be updated to explain what the reason is for this
change. Probably it makes sense to be in a separate PR.
--
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]