You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "dondaum (via GitHub)" <gi...@apache.org> on 2024/04/27 21:52:29 UTC
[PR] fix: sqa deprecations for airflow providers [airflow]
dondaum opened a new pull request, #39293:
URL: https://github.com/apache/airflow/pull/39293
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<!--
Thank you for contributing! Please make sure that your code changes
are covered with tests. And in case of new features or big changes
remember to adjust the documentation.
Feel free to ping committers for the review!
In case of an existing issue, reference it using one of the following:
closes: #ISSUE
related: #ISSUE
How to write a good git commit message:
http://chris.beams.io/posts/git-commit/
-->
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](https://docs.sqlalchemy.org/en/20/changelog/migration_20.html#implicit-and-connectionless-execution-bound-metadata-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
- [x] [airflow/providers/openlineage/utils/sql.py:152](https://github.com/apache/airflow/blob/15eedd080428314cf6e27443f91624459d17a77d/airflow/providers/openlineage/utils/sql.py#L152)
- [x] [airflow/providers/fab/auth_manager/security_manager/override.py:1509](https://github.com/apache/airflow/blob/15eedd080428314cf6e27443f91624459d17a77d/airflow/providers/fab/auth_manager/security_manager/override.py#L1509)
<!-- Please keep an empty line above the dashes. -->
---
**^ Add meaningful description above**
Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)** for more information.
In case of fundamental code changes, an Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals)) is needed.
In case of a new dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
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](https://github.com/apache/airflow/tree/main/newsfragments).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix: sqa deprecations for airflow providers [airflow]
Posted by "dondaum (via GitHub)" <gi...@apache.org>.
dondaum commented on code in PR #39293:
URL: https://github.com/apache/airflow/pull/39293#discussion_r1582363450
##########
airflow/providers/fab/auth_manager/security_manager/override.py:
##########
@@ -1506,14 +1506,15 @@ def add_user(
user.username = username
user.email = email
user.active = True
+ self.get_session.add(user)
Review Comment:
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.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix: sqa deprecations for airflow providers [airflow]
Posted by "dondaum (via GitHub)" <gi...@apache.org>.
dondaum commented on code in PR #39293:
URL: https://github.com/apache/airflow/pull/39293#discussion_r1596020683
##########
airflow/providers/fab/auth_manager/security_manager/override.py:
##########
@@ -1506,14 +1506,15 @@ def add_user(
user.username = username
user.email = email
user.active = True
+ self.get_session.add(user)
Review Comment:
As we discussed [here](https://github.com/apache/airflow/pull/39299#issuecomment-2092597149) we try to fix all warnings. So IMO this change looks good.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix: sqa deprecations for airflow providers [airflow]
Posted by "Taragolis (via GitHub)" <gi...@apache.org>.
Taragolis commented on code in PR #39293:
URL: https://github.com/apache/airflow/pull/39293#discussion_r1588860590
##########
airflow/providers/fab/auth_manager/security_manager/override.py:
##########
@@ -1506,14 +1506,15 @@ def add_user(
user.username = username
user.email = email
user.active = True
+ self.get_session.add(user)
Review Comment:
I guess that is Models from the [FAB](https://github.com/dpgaspar/Flask-AppBuilder), which do not supports SA20 neither.
cc: @vincbeck maybe you have information about it?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org