Skip to content

Conversation

@potiuk
Copy link
Member

@potiuk potiuk commented Nov 30, 2022

This is a breaking change, that changes return value of the Hook, however it keeps compatibility with regards of the value returned by the SnowflakeOperator (so DAGs using the operator should be unaffected).

At the same time SnowflakeHook can be used in a number of generic operators and sensors such as:

  • SQLColumnCheckOperator
  • SQLSensor

Fixes: #27978
Fixes: #27976


^ Add meaningful description above

Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an 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 a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in newsfragments.

@potiuk
Copy link
Member Author

potiuk commented Nov 30, 2022

If this one will be ok for others, I will fix all failing tests (if there will be some) and add a set of tests like I did for Databricks Hook: https://github.com/apache/airflow/blob/main/tests/providers/databricks/hooks/test_databricks_sql.py

@potiuk
Copy link
Member Author

potiuk commented Nov 30, 2022

cc: @kazanzhy @denimalpaca . This is hopefull the LAST (🤞 ) of standardising Hook's run() behaviour. And I hope later on we might be even able to switch to using the common.sql one for both Snowflake and Exasol (they are the two remaining Hooks with custom run() - but after this change, they are conforming to the same semantics, so we should be able to replace the custom run() methods easily.

@potiuk
Copy link
Member Author

potiuk commented Nov 30, 2022

Ah... Tests passed so we REALLY need to add more tests, because we do not test what we should :)

@potiuk potiuk force-pushed the standardize-snowflake-hook-run-results branch from e1503d0 to 931d08f Compare November 30, 2022 12:55
@potiuk
Copy link
Member Author

potiuk commented Nov 30, 2022

I addeed million tests - similar as we have in Databricks case (and it's good I did - I found few issues).

@potiuk potiuk requested review from ephraimbuddy and removed request for gmcdonald November 30, 2022 14:31
Copy link
Contributor

@vincbeck vincbeck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One minor comment, otherwise LGTM

@potiuk potiuk force-pushed the standardize-snowflake-hook-run-results branch from 931d08f to 13b60d5 Compare November 30, 2022 19:24
@potiuk potiuk force-pushed the standardize-snowflake-hook-run-results branch from 13b60d5 to 58065aa Compare November 30, 2022 21:05
@potiuk potiuk force-pushed the standardize-snowflake-hook-run-results branch from 58065aa to 09c4957 Compare November 30, 2022 21:29
This is a breaking change, that changes return value of the Hook,
however it keeps compatibility with regards of the value returned
by the SnowflakeOperator (so DAGs using the operator should be
unaffected).

You can also switch back to the Dictionary returned by Hooks by
specifying ``return_dictionaries`` parameter to run method of
the Hook.

At the same time SnowflakeHook can be used in a number of generic
operators and sensors such as:

* SQLColumnCheckOperator
* SQLSensor

Fixes: apache#27978
Fixes: apache#27976
@potiuk potiuk force-pushed the standardize-snowflake-hook-run-results branch from 09c4957 to 4ff1099 Compare November 30, 2022 22:46
@potiuk potiuk merged commit d9cefcd into apache:main Dec 1, 2022
@potiuk potiuk deleted the standardize-snowflake-hook-run-results branch December 1, 2022 13:53
jrggggg pushed a commit to jrggggg/airflow that referenced this pull request Dec 1, 2022
* Make Snowflake Hook conform to semantics of DBApi

This is a breaking change, that changes return value of the Hook,
however it keeps compatibility with regards of the value returned
by the SnowflakeOperator (so DAGs using the operator should be
unaffected).

You can also switch back to the Dictionary returned by Hooks by
specifying ``return_dictionaries`` parameter to run method of
the Hook.

At the same time SnowflakeHook can be used in a number of generic
operators and sensors such as:

* SQLColumnCheckOperator
* SQLSensor

Fixes: apache#27978
Fixes: apache#27976
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:providers provider:snowflake Issues related to Snowflake provider

Projects

None yet

Development

Successfully merging this pull request may close these issues.

KeyError: 0 error with common-sql version 1.3.0 SQLColumnCheckOperator failures after upgrading to common-sql==1.3.0

5 participants