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:
It's not clear from the PR description why you're making the change with
`allowed_conn_types`. It doesn't seem like it's necessary as part of adding
`hook_kwargs`, but seems completely unrelated.
Probably it makes sense to be in a separate PR. But at least the
description should be updated to explain what the reason is for this change.
--
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]