Skip to content

Conversation

@kacpermuda
Copy link
Contributor

@kacpermuda kacpermuda commented Jun 9, 2025

Few fixes included in this PR:

  1. SnowflakeSqlApiHook.execute_query will now consistently reset query_ids each time it's called, exactly like SnowflakeHook.run does. Currently the behavior depended on number of queries executed, which could cause getting query_ids from previous execution as an attribute - sometimes it was overwritten, sometimes not.
  2. SnowflakeSqlApiTrigger will now return the query_ids of query actually executed, instead of child query_ids of multi-statement queries, which is consistent with non-deferrable behavior that we have right now. This change makes the behavior consistent regardless of execution mode.
  3. I've added re-assignment of query_ids after coming back from deferral in SnowflakeSqlApiOperator, so that the listeners can use that information and have consistent behavior regardless of execution mode.
  4. I've added an explicit caching of SnowflakeSqlApiHook in SnowflakeSqlApiOperator, right now the property of super class SQLExecuteQueryOperator was overwritten during execution, which could lead to inconsistencies, depending on when you ask for SnowflakeSqlApiOperator._hook.
  5. Added missing self.query_ids definition in init of SnowflakeSqlApiOperator

Added tests for all changes.


^ 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.

@kacpermuda kacpermuda requested review from mik-laj and potiuk as code owners June 9, 2025 16:47
@boring-cyborg boring-cyborg bot added area:providers provider:snowflake Issues related to Snowflake provider labels Jun 9, 2025
@potiuk potiuk merged commit f6ec3a0 into apache:main Jun 11, 2025
68 checks passed
@kacpermuda kacpermuda deleted the fix-snowflake-api-op branch June 11, 2025 12:09
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.

3 participants