-
Notifications
You must be signed in to change notification settings - Fork 16.1k
Closed
Labels
area:providerskind:bugThis is a clearly a bugThis is a clearly a bugprovider:snowflakeIssues related to Snowflake providerIssues related to Snowflake provider
Description
logs_test_dbt_multi_repo_v1_manual__2025-12-13T09_15_44+00_00_snow_-1_1.txt
Apache Airflow Provider(s)
snowflake
Versions of Apache Airflow Providers
apache-airflow-providers-snowflake==6.7.0
Apache Airflow version
3.1.4
Operating System
debian
Deployment
Astronomer
Deployment details
No response
What happened
When using SnowflakeSqlApiOperator in deferred mode (deferrable=True), the operator generates a new JWT token on every polling attempt instead of reusing the existing token. This causes:
- Performance overhead: Unnecessary token generation on every poll (which can happen every few seconds)
- Log pollution: INFO level logs are generated on every poll, flooding the task logs and making it difficult to track actual task progress
Current Behavior
In deferred mode, when the operator polls for query status, it generates a new JWT token for each poll attempt, even though the previous token is still valid. This results in:
- Excessive token generation operations
- Cluttered logs with repeated JWT generation messages
What you think should happen instead
The JWT token should be reused across polling attempts until it expires or needs renewal. Token generation should only occur when:
- No token exists yet
- The token has expired
- The token renewal time has been reached
How to reproduce
- Create a
SnowflakeSqlApiOperatorwithdeferrable=True - Execute a long-running query that requires multiple polls
- Observe the logs - you'll see JWT token generation logs on every poll
- Check the task logs - they will be cluttered with JWT generation messages
Anything else
Impact
- Performance: Unnecessary cryptographic operations on every poll
- Log pollution: INFO level logs on every poll make it difficult to track actual task progress
- Resource waste: CPU cycles spent on token generation that could be avoided
Additional Context
The token caching mechanism exists but is not being utilized effectively in deferred mode.
Are you willing to submit PR?
- Yes I am willing to submit a PR!
Code of Conduct
- I agree to follow this project's Code of Conduct
Metadata
Metadata
Assignees
Labels
area:providerskind:bugThis is a clearly a bugThis is a clearly a bugprovider:snowflakeIssues related to Snowflake providerIssues related to Snowflake provider