Skip to content

Conversation

@amoghrajesh
Copy link
Contributor

Why

The current code checks for two different exception types when handling connection not found errors:

  • AirflowNotFoundException (from core)
  • AirflowRuntimeError with ErrorType.CONNECTION_NOT_FOUND (from Task SDK)

However, self.get_connection() in hooks consistently raises AirflowNotFoundException regardless of Airflow version. The SDK specific AirflowRuntimeError is only raised in direct Task SDK API calls, not through the hook's get_connection method.


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

@amoghrajesh amoghrajesh requested a review from ferruzzi August 9, 2025 04:57
@boring-cyborg boring-cyborg bot added area:providers provider:amazon AWS/Amazon - related issues labels Aug 9, 2025
@amoghrajesh amoghrajesh requested review from ashb and kaxil August 9, 2025 04:57
@amoghrajesh amoghrajesh self-assigned this Aug 9, 2025
@amoghrajesh
Copy link
Contributor Author

CC @ramitkataria I went ahead and made this change as we discussed last, can I please get a review?

@amoghrajesh amoghrajesh requested review from jscheffl and potiuk August 10, 2025 16:45
@potiuk
Copy link
Member

potiuk commented Aug 10, 2025

However, self.get_connection() in hooks consistently raises AirflowNotFoundException regardless of Airflow version. The SDK specific AirflowRuntimeError is only raised in direct Task SDK API calls, not through the hook's get_connection method.

Nice!

Copy link
Contributor

@ramitkataria ramitkataria left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just 1 nit but looks good to me. Thanks for the PR!

@amoghrajesh amoghrajesh merged commit 81538ef into apache:main Aug 12, 2025
77 checks passed
ramitkataria added a commit to aws-mwaa/upstream-to-airflow that referenced this pull request Aug 13, 2025
After apache#54299, there was a bit of except handling left over that appears
to be redundant. It looks functionally equivalent to not having the
additional handling.
potiuk pushed a commit that referenced this pull request Aug 15, 2025
After #54299, there was a bit of except handling left over that appears
to be redundant. It looks functionally equivalent to not having the
additional handling.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:providers provider:amazon AWS/Amazon - related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants