Skip to content

Conversation

@arorasachin9
Copy link
Contributor

In AWS Secret Manager provider we are inheriting from the BaseSecretManager class which is still using older import leading to
WARNING Using Connection.from_json from airflow.models is deprecated.Please use from_json on Connection from sdk(airflow.sdk.Connection) instead
So moved the import from the new sdk which will remove the WARNING message of deprecated import. I have added try catch to keep the backward compatibility which can be removed once we deprecate the older classes.
SS for previous output:
Screenshot 2025-11-30 at 8 41 00 PM
SS for new output:
Screenshot 2025-11-30 at 8 41 09 PM

@arorasachin9
Copy link
Contributor Author

Are we not supposed to import the sdk imports in the core folder
The static check is failing

Check for SDK imports in core files..............................................Failed

  • hook id: check-sdk-imports

  • exit code: 1

    src/airflow/secrets/base_secrets.py:
    Line 25: from airflow.sdk import Connection
    Line 67: from airflow.sdk import Connection

    Found 2 SDK import(s) in core files

If we are not supposed to do so any suggested workaround for this warning or we have to move this class also in airflow sdk.
If we can update in core only then I'll fix the other failing test cases.

@dstandish @ashb

@shahar1
Copy link
Contributor

shahar1 commented Nov 30, 2025

It seems that it's not straight forward :(

Copy link
Contributor

@amoghrajesh amoghrajesh left a comment

Choose a reason for hiding this comment

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

@arorasachin9 thanks for trying this one out, this is already part of a bigger effort here: secrets backend is being reworked in the sense that it is being moved to shared library at the moment: #58621, the advantage of that is, it will dynamically detect the context it is run in - server (scheduler, api server) and client (worker, dag processor, triggerer) and grok the class automatically.

Copy link
Contributor

@amoghrajesh amoghrajesh left a comment

Choose a reason for hiding this comment

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

Requesting changes to avoid accidental merge, check my comment above

@arorasachin9
Copy link
Contributor Author

NA

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants