Skip to content

Snowflake: Preserve 422 response payload instead of raising HTTP error. #60765

Description

@HyunWooZZ

Apache Airflow Provider(s)

snowflake

Versions of Apache Airflow Providers

6.8.2

Apache Airflow version

2.11.0

Operating System

NAME="Amazon Linux" VERSION="2023"

Deployment

Amazon (AWS) MWAA

Deployment details

No response

What happened

When using SnowflakeSqlApiHook HTTP 422 (query failure) responses from the Snowflake SQL API are immediately raised via response.raise_for_status().

Because of this, the response body is never read, and the hook loses the JSON/text payload
returned by Snowflake.
As a result, downstream components (e.g. TriggerEvent logs) only receive a generic ClientResponseError message such as:

422, message='Unprocessable Entity', url='https://<account>.snowflakecomputing.com/...'

What you think should happen instead

We need to pass this payload to _process_response method.
There is already enhanced message payload handler.

How to reproduce

  1. Submit a Snowflake SQL query that results in a statement-level error, for example:
SELECT 1 / 0;
  1. Poll the query status using SnowflakeSqlApiHook.

  2. The Snowflake SQL API returns an HTTP 422 (Unprocessable Entity) response.

  3. The hook raises an HTTP error via response.raise_for_status(), and the response payload is discarded.

Anything else

I will handle this issue with below issue.
#60689

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions