Handle HTTP 422 responses bypass to _process_response instead of raising immediately in Snowflake SQL API hook.#60891
Merged
shahar1 merged 6 commits intoapache:mainfrom Feb 10, 2026
Conversation
potiuk
reviewed
Jan 22, 2026
Member
potiuk
left a comment
There was a problem hiding this comment.
LGTM but you need to fix static checks. prek to the rescue
choo121600
approved these changes
Jan 22, 2026
Member
choo121600
left a comment
There was a problem hiding this comment.
LGTM!
Just need to fix the static check failures 😀
You can follow the guidelines in the doc below to resolve them easily:
https://github.com/apache/airflow/blob/main/contributing-docs/08_static_code_checks.rst
Contributor
Author
|
Thank you both for your help! :) @potiuk could you review it again? |
Contributor
Author
|
@potiuk |
shahar1
approved these changes
Feb 10, 2026
81 tasks
Alok-kumar-priyadarshi
pushed a commit
to Alok-kumar-priyadarshi/airflow
that referenced
this pull request
Feb 11, 2026
…ing immediately in Snowflake SQL API hook (apache#60891)
Ratasa143
pushed a commit
to Ratasa143/airflow
that referenced
this pull request
Feb 15, 2026
…ing immediately in Snowflake SQL API hook (apache#60891)
choo121600
pushed a commit
to choo121600/airflow
that referenced
this pull request
Feb 22, 2026
…ing immediately in Snowflake SQL API hook (apache#60891)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adjusts the error-handling behavior of SnowflakeSqlApiHook so that HTTP 422 responses are not raised immediately by raise_for_status(), but instead passed through to _process_response() for Snowflake-specific error parsing.
(We already implemented message parsing method, but we haven't leveraged.)
Snowflake SQL API uses 422 (Unprocessable Entity) to return rich, structured error payloads (e.g. STATEMENT_ERROR, STATEMENT_NOT_FOUND, Compile Error).
Raising early discards this payload and prevents the hook from providing meaningful error context to users.
related: #60765
Details
Previously, raise_for_status() was called unconditionally, causing 422 responses to raise early and skip _process_response().
This PR updates the request flow:
Applies the same behavior to both sync and async API calls.
Tests
Added tests to verify that HTTP 422 does not call raise_for_status() and returns (status, body) for:
Added tests to confirm that HTTP 500 still raises and does not return a response body.
Refactored test helpers to make mocked HTTP responses more explicit and easier to control.
references
https://docs.snowflake.com/en/developer-guide/sql-api/reference
https://docs.snowflake.com/en/developer-guide/sql-api/reference#label-sql-api-reference-queryfailurestatus