Improve SnowflakeSqlApiOperator error message on query status check failure#66642
Improve SnowflakeSqlApiOperator error message on query status check failure#66642justinpakzad wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
I think this is an interesting one to think more about. So, the exception that is being thrown is from a failure when hitting the Snowflake API, not a failure of the query.
I'm not sure that it makes sense to remove the query and mark the statement as being failed. For example, what if your creds expire? This would cause the status check to fail even if the statement is running correctly. Your unit test captures this scenario (connection timing out) which doesn't mean that the query failed.
|
@justinpakzad - I think it might make sense to raise a more specific exception rather than just a |
Hey, thanks for the review. To address your first comment - that's a good point, slipped over my head a bit that there is a distinction between a query failure and other types of errors that don't necessarily mean there was a failure on the query end (as you mentioned). Are you suggesting we just revert it back but maybe with something like: try:
statement_status = self._hook.get_sql_api_query_status(query_id)
except Exception as e:
raise RuntimeError(f"Failed to get status for query {query_id}: {e}") from e |
|
Yes, I think that would make sense! |
c03ce37 to
6348406
Compare
jroachgolf84
left a comment
There was a problem hiding this comment.
Thanks for the change, this LGTM!
Replace ValueError with RuntimeError on query status check failure in poll_on_queries, including the query id and original error for better debuggability. Added a new test to ensure a RuntimeError is raised when status check fails.
Was generative AI tooling used to co-author this PR?
{pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.