Skip to content

feat: Add new query related methods to SnowflakeSqlApiHook #52157

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

Merged

Conversation

kacpermuda
Copy link
Contributor

@kacpermuda kacpermuda commented Jun 24, 2025

Adding new methods to SnowflakeSqlApiHook: wait_for_query and get_result_from_successful_sql_api_query.

We already have some methods that log api response with rows, but none that actually return rows. Also, there is no method on hook that will poll for query status and wait for success, as the queries are run async via the API.

With these new methods, this is the flow to run query and get the results:

query_id = hook.execute_query(sql=sql, statement_count=0)[0]
hook.wait_for_query(query_id=query_id)
result = hook.get_result_from_successful_sql_api_query(query_id=query_id)

I have another PR that will use these methods, but decided to split it into two for clarity.


^ 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 airflow-core/newsfragments.

@gopidesupavan
Copy link
Member

LGTM overall ..

@kacpermuda kacpermuda force-pushed the feat-snowflake-api-hook-new-methods branch from 91f97c1 to a0b9296 Compare June 26, 2025 11:52
@gopidesupavan gopidesupavan merged commit 40a3c7e into apache:main Jun 27, 2025
68 checks passed
@kacpermuda kacpermuda deleted the feat-snowflake-api-hook-new-methods branch June 27, 2025 10:55
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.

2 participants