-
Notifications
You must be signed in to change notification settings - Fork 14.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Snowflake support to SQL operator and sensor #9843
Conversation
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contribution Guide (https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst)
|
@@ -80,6 +80,7 @@ | |||
"postgres": ("airflow.providers.postgres.hooks.postgres.PostgresHook", "postgres_conn_id"), | |||
"presto": ("airflow.providers.presto.hooks.presto.PrestoHook", "presto_conn_id"), | |||
"redis": ("airflow.providers.redis.hooks.redis.RedisHook", "redis_conn_id"), | |||
"snowflake": ("airflow.providers.snowflake.hooks.snowflake.SnowflakeHook", "snowflake_conn_id"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you mind adding a simple test to check that all hooks' path are valid? For example using importlib? We can try to use airflow.utils.module_loading.import_string
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@turbaszek Added, but requires updating the MSSQL mapping to ODBC per deprecation notice. Since pymssql is deprecated, the existing hook throws an import error for the existing MSSQL mapping.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good! In this way, you've found a bug 👌
tests/models/test_connection.py
Outdated
for conn_type in CONN_TYPE_TO_HOOK: | ||
self.assertTrue(issubclass(import_string(CONN_TYPE_TO_HOOK[conn_type][0]), BaseHook)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for conn_type in CONN_TYPE_TO_HOOK: | |
self.assertTrue(issubclass(import_string(CONN_TYPE_TO_HOOK[conn_type][0]), BaseHook)) | |
for hook_path, _ in CONN_TYPE_TO_HOOK.values(): | |
self.assertTrue(issubclass(import_string(hook_path), BaseHook)) |
WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. This is much cleaner.
Awesome work, congrats on your first merged pull request! |
* Add Snowflake support to SQL operator and sensor * Add test for conn_type to valid hook mapping * Improve code quality for conn type mapping test
Marked for inclusion to 1.10.12. Should be easy to cherry-pick |
* Add Snowflake support to SQL operator and sensor * Add test for conn_type to valid hook mapping * Improve code quality for conn type mapping test (cherry picked from commit 9c68e7c)
* Add Snowflake support to SQL operator and sensor * Add test for conn_type to valid hook mapping * Improve code quality for conn type mapping test (cherry picked from commit 9c68e7c)
* Add Snowflake support to SQL operator and sensor * Add test for conn_type to valid hook mapping * Improve code quality for conn type mapping test (cherry picked from commit 9c68e7c)
Add Snowflake as supported database backend for SQL operator and sensor. This is primarily an update to the
allowed_conn_type
sets for the corresponding classes.Closes #9548
Make sure to mark the boxes below before creating PR: [x]
In case of fundamental code change, Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in UPDATING.md.
Read the Pull Request Guidelines for more information.