-
Notifications
You must be signed in to change notification settings - Fork 16.3k
feat(snowflake_hook): Adding oauth support for SnowflakeHook #47073
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
feat(snowflake_hook): Adding oauth support for SnowflakeHook #47073
Conversation
bugraoz93
left a comment
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.
Looks good! Thanks for the changes! Only have a small nit.
| access_token = self.get_oauth_token(conn_config=conn_config) | ||
| conn_config["token"] = access_token |
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.
| access_token = self.get_oauth_token(conn_config=conn_config) | |
| conn_config["token"] = access_token | |
| conn_config["token"] = self.get_oauth_token(conn_config=conn_config) |
Not a blocker but a small nit.
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.
Made this change and pushed.
bugraoz93
left a comment
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.
Amazing thanks!
|
conflicts :( |
90fba16 to
2791f73
Compare
|
Merge conflicts have been resolved! |
e130f3f to
64c4213
Compare
…n_config dict instead of via variable
64c4213 to
437b17a
Compare
* Edge worker maintenance mode can be set from cli * apply review findings * add misc * delete outdated code part --------- Co-authored-by: Majoros Donat (XC-DX/EET2-Bp) <donat.majoros2@hu.bosch.com>
The apache#47105 wrongly assumed that the new ydb version caused the problem with grpc.io, it turned out however that the root cause was wrong grpcio specification for yandexcloud - where grpcio requirement did not match runtime check for version. Excluding the versions of yandexcloud (and asking them to yank those versions) should help in solving the problem and it should not limit users to upgrade to newer versions of yandexcloud (when they are not using apache.beam or other libraries that limit grpcio to < 1.68.1)
* Add Mapped Task Summary page * Remove mapped task instance lookup in dag breadcrumb
`airflow webserver` was added to the list of legacy commands, which means users will be informed of the replacement instead of just getting a generic error: ``` $ airflow webserver Usage: airflow [-h] GROUP_OR_COMMAND ... ... airflow command error: argument GROUP_OR_COMMAND: Command `airflow webserver` has been removed. Please use `airflow api-server`, see help above. ```
The intent behind this isinstance check was to deal with this, but it was missed that you can't import it on Airflow 3. Oops Closes apache#47139
This included renaming the following args to better match fastapi/uvicorn: - `--hostname` -> `--host` - `--debug` -> `--dev` The following config options were removed (there isn't an equivalent currently): - `[webserver] error_logfile` - `[webserver] access_logformat` The following config options were moved/renamed to the `api` section. - `[webserver] web_server_host` has been moved to `[api] host` - `[webserver] web_server_port` has been moved to `[api] port` - `[webserver] workers` has been moved to `[api] workers` - `[webserver] web_server_worker_timeout` has been moved to `[api] worker_timeout` - `[webserver] web_server_ssl_cert` has been moved to `[api] ssl_cert` - `[webserver] web_server_ssl_key` has been moved to `[api] ssl_key` - `[webserver] access_logfile` has been moved to `[api] access_logfile`
…pache#47155) When provider.yaml or pypyroject.toml changes for a provider, that should trigger CI-image bound static checks - because only there we verify provider.yaml and it might trigger CI image build to get new dependencies that might fail the CI image build.
* WIP: List Backfills * Resolve review comments * Removed id and split dates into from-to * Updated duration * Append s to duration field * Remove sorting and adding new columns * Updated icon in dag
The Tasksdk datamodel codegen has not been fixed and when new version was released it caused pre-commit to fail. Fixing it, to specific version should add reproducibility, at the same time dependabot of ours will create PRs when new version is released so we are not loosing auto-upgrade features.
…ache#47148) * Add methodtools as a dependency of the common-sql provider Since `apache-airflow-providers-common-sql==1.23.0`, released on 26 February 2025, users started facing the error: ``` from cosmos.operators._asynchronous.bigquery import DbtRunAirflowAsyncBigqueryOperator cosmos/operators/_asynchronous/bigquery.py:8: in <module> from airflow.providers.google.cloud.operators.bigquery import BigQueryInsertJobOperator ../../../.local/share/hatch/env/virtual/astronomer-cosmos/Za_bFbg4/tests.py3.12-2.9/lib/python3.12/site-packages/airflow/providers/google/cloud/operators/bigquery.py:32: in <module> from airflow.providers.common.sql.operators.sql import ( # type: ignore[attr-defined] # for _parse_boolean ../../../.local/share/hatch/env/virtual/astronomer-cosmos/Za_bFbg4/tests.py3.12-2.9/lib/python3.12/site-packages/airflow/providers/common/sql/operators/sql.py:[29](https://github.com/astronomer/astronomer-cosmos/actions/runs/13544957799/job/37854234771#step:6:30): in <module> from airflow.providers.common.sql.hooks.sql import DbApiHook, fetch_all_handler, return_single_query_results ../../../.local/share/hatch/env/virtual/astronomer-cosmos/Za_bFbg4/tests.py3.12-2.9/lib/python3.12/site-packages/airflow/providers/common/sql/hooks/sql.py:37: in <module> from methodtools import lru_cache E ModuleNotFoundError: No module named 'methodtools' ``` It seems this started happening since apache#41327. This PR aims to solve this issue. Closes: apache#47147 * Fix linting * Revert change to provider.yaml and applyc hange to pyproject.toml
This makes the process of developing and debugging much more plesant, as without this we get 0 logging (just a "500" access log line) in case of an unhandled exception.
* Update INTHEWILD.md This PR adds Blue3 Investimentos to the INTHEWILD.md file, which tracks organizations using this project in production. Blue3 Investimentos is a financial investment company that has incorporated this tool into their workflow. * Update INTHEWILD.md Co-authored-by: Jed Cunningham <66968678+jedcunningham@users.noreply.github.com> * sort correct --------- Co-authored-by: Jed Cunningham <66968678+jedcunningham@users.noreply.github.com>
Common.sql self-deprecated itself after apache#43747 by importing handlers from the old location.
Co-authored-by: Jed Cunningham <66968678+jedcunningham@users.noreply.github.com>
|
Closing this PR since I messed up with updating the branch, will fix this and reopen the PR. |
This PR enhances the SnowflakeHook in the Airflow repo by completing the OAuth authentication flow. It adds logic to fetch the access token using the refresh_token, client_id, and client_secret, which are already managed in the extras of the Snowflake connection object.
Changes & Fixes:
Implements logic to exchange the refresh_token for a new access token before establishing a connection.
Resolves an issue where using refresh_token, client_id, and client_secret directly with SnowflakeHook results in the error:
main/newsfragments).