Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: sqa deprecations for airflow providers #39293

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dondaum
Copy link
Contributor

@dondaum dondaum commented Apr 27, 2024

related: #28723

fix deprecations for SQLAlchemy 2.0 for Airflow providers.

FAB
SQLAlchemy 2.0 is changing the behavior when an object is being merged into a Session along the backref cascade. The User needs to be present in the session before it is merged with backref cascade for relationship Role.user.

Openlineage
Removed the sqlalchemy_engine completely. First of all in SQLAlchemy 2.0 the ability to associate an Engine with MetaData object is removed, second IMO the sqlalchemy_engine is not used at all in the function. It is passed to MetaData but not used afterwards.

Reported in providers


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

@@ -1506,14 +1506,15 @@ def add_user(
user.username = username
user.email = email
user.active = True
self.get_session.add(user)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This fixes the SQA 2.0 warning however I think we might could / should leave it as it is. SQA 2.0 complains about the User object that is being merged into a Session along the backref cascade. In SQA 2.0 this won't happen. But we add the User object explicit to session so IMO we should be fine without the change.

Copy link
Contributor

Choose a reason for hiding this comment

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

I guess that is Models from the FAB, which do not supports SA20 neither.

cc: @vincbeck maybe you have information about it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As we discussed here we try to fix all warnings. So IMO this change looks good.

@dirrao dirrao requested a review from Taragolis April 29, 2024 03:59
@dondaum dondaum force-pushed the fix/sqa-deprecations-airflow-providers branch from adcf9d4 to 9bab1fd Compare May 1, 2024 21:57
@eladkal eladkal requested a review from vincbeck May 3, 2024 19:10
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.

None yet

4 participants