You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "amindadgar (via GitHub)" <gi...@apache.org> on 2024/03/12 08:40:07 UTC

[PR] Sqlalchemy dependency update [airflow]

amindadgar opened a new pull request, #38066:
URL: https://github.com/apache/airflow/pull/38066

   <!--
    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/
   -->
   Updating executemany_mode for supporting sqlalchemy>=2.0.0
   Trying to resolve the issue https://github.com/apache/airflow/issues/38064
   
   
   <!-- 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] Sqlalchemy dependency update [airflow]

Posted by "Taragolis (via GitHub)" <gi...@apache.org>.
Taragolis commented on code in PR #38066:
URL: https://github.com/apache/airflow/pull/38066#discussion_r1523709944


##########
airflow/settings.py:
##########
@@ -273,7 +273,7 @@ def configure_orm(disable_connection_pool=False, pool_class=None):
 
 DEFAULT_ENGINE_ARGS = {
     "postgresql": {
-        "executemany_mode": "values",
+        "executemany_mode": "values_only",

Review Comment:
   Yep, `values` even not listed in allowed values in 1.4.
   But as I could understand the `values` -> `values_plus_batch `
   
   https://github.com/sqlalchemy/sqlalchemy/issues/5401



-- 
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] Sqlalchemy dependency update [airflow]

Posted by "amindadgar (via GitHub)" <gi...@apache.org>.
amindadgar commented on PR #38066:
URL: https://github.com/apache/airflow/pull/38066#issuecomment-1991127737

   @Taragolis Thanks for your checking. So I see two options
   1. Wait for FAB library to update their dependency or
   2. To contribute to their library
   
   Is there another easy way we could follow?


-- 
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] Sqlalchemy dependency update [airflow]

Posted by "amindadgar (via GitHub)" <gi...@apache.org>.
amindadgar commented on code in PR #38066:
URL: https://github.com/apache/airflow/pull/38066#discussion_r1525821374


##########
airflow/settings.py:
##########
@@ -273,7 +273,7 @@ def configure_orm(disable_connection_pool=False, pool_class=None):
 
 DEFAULT_ENGINE_ARGS = {
     "postgresql": {
-        "executemany_mode": "values",
+        "executemany_mode": "values_only",

Review Comment:
   > Ahhh... I miss this change. Yeah we definitely should keep support of SA 1.4 as much as possible, not all providers could work with SA 2.0
   > 
   > But also I'm not sure that we need to add support SA 2.0, because I'm not totally sure that Airflow could work with it properly.
   
   Agreed. The FAB library you mentioned earlier is required to update their SA. I'll have a quick look on what is needed to update that dependency.



-- 
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] Sqlalchemy dependency update [airflow]

Posted by "amindadgar (via GitHub)" <gi...@apache.org>.
amindadgar commented on PR #38066:
URL: https://github.com/apache/airflow/pull/38066#issuecomment-1999032280

   > > @Taragolis Thanks for your checking. So I see two options
   > > 
   > > 1. Wait for FAB library to update their dependency or
   > > 2. To contribute to their library
   > > 
   > > Is there another easy way we could follow?
   > 
   > Generally this is the only way to follow. We need somoene (for example you, but can be anyone) to follow up and close all the issues internally (fix all deprecations etc) and nag (or help as you mentioned) everyone who is a blocker to upgrade, and then update all the dependencies (or wait until somoene else does it). Or just wait until they do - this will happen eventually even without you nagging them.
   > 
   > Another option of course is to replace the dependencies with others to do the same when we see no option for them to upgrade quickly.
   > 
   > All this is for example what happened when we **just** added Python 3.12. This one took 5 months till Python 3.12 was released and finally we got it merged yesterday.
   > 
   > I think a good start (and this is something you could do if you want to make it more progressing) is to create a separate issue named "Sqlalchemy 3 upgrade" where you will track down and list with
   > 
   > * [ ]  checkmarks
   > 
   > all the things that need to happen - and then link (and mark as duplicate) all the issues that refer to it - including the #38064
   > 
   > That would be a very good way to contribute to make that happen eventually. You are most welcome to do that and take a leadership on nagging others and maybe making PRs to fix thins internally.
   
   Thanks for your detailed response. I would love to contribute to this project but unfortunately, I'm very busy with another open source project. Special thanks to @Taragolis for taking the lead on this PR. I see the questions are answered by Taragolis, but if there's any more input required from me, please don't hesitate to ask :)


-- 
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] Sqlalchemy dependency update [airflow]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #38066:
URL: https://github.com/apache/airflow/pull/38066#issuecomment-2094510233

   This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 5 days if no further activity occurs. Thank you for your contributions.


-- 
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] Sqlalchemy dependency update [airflow]

Posted by "Taragolis (via GitHub)" <gi...@apache.org>.
Taragolis commented on PR #38066:
URL: https://github.com/apache/airflow/pull/38066#issuecomment-1991328183

   It might be good to change default value for execute many for PG, because seems like it didn't change for a long time, and it only valid in SA 1.3, SA 1.4 look like silently fallback to valid value, in SA 2.0+ it is invalid
   - SA 1.3: https://docs.sqlalchemy.org/en/13/dialects/postgresql.html#psycopg2-fast-execution-helpers
   - SA 1.4: https://docs.sqlalchemy.org/en/14/dialects/postgresql.html#psycopg2-fast-execution-helpers
   - SA 2.0: https://docs.sqlalchemy.org/en/20/dialects/postgresql.html#psycopg2-fast-execution-helpers


-- 
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] Sqlalchemy dependency update [airflow]

Posted by "uranusjr (via GitHub)" <gi...@apache.org>.
uranusjr commented on code in PR #38066:
URL: https://github.com/apache/airflow/pull/38066#discussion_r1523751495


##########
airflow/settings.py:
##########
@@ -273,7 +273,7 @@ def configure_orm(disable_connection_pool=False, pool_class=None):
 
 DEFAULT_ENGINE_ARGS = {
     "postgresql": {
-        "executemany_mode": "values",
+        "executemany_mode": "values_only",

Review Comment:
   In that case maybe we don't need to raise the lower version bound, and can make the version range `>1.4.36,<2.1.0` instead?



-- 
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] Sqlalchemy dependency update [airflow]

Posted by "uranusjr (via GitHub)" <gi...@apache.org>.
uranusjr commented on code in PR #38066:
URL: https://github.com/apache/airflow/pull/38066#discussion_r1521933004


##########
airflow/settings.py:
##########
@@ -273,7 +273,7 @@ def configure_orm(disable_connection_pool=False, pool_class=None):
 
 DEFAULT_ENGINE_ARGS = {
     "postgresql": {
-        "executemany_mode": "values",
+        "executemany_mode": "values_only",

Review Comment:
   Does 1.4 support `values_only`?



-- 
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] Sqlalchemy dependency update [airflow]

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on code in PR #38066:
URL: https://github.com/apache/airflow/pull/38066#discussion_r1531807443


##########
airflow/settings.py:
##########
@@ -273,7 +273,7 @@ def configure_orm(disable_connection_pool=False, pool_class=None):
 
 DEFAULT_ENGINE_ARGS = {
     "postgresql": {
-        "executemany_mode": "values",
+        "executemany_mode": "values_only",

Review Comment:
   FAB is being migrated in https://github.com/apache/airflow/pull/38319  to 4.4.1 -but still sqlalchemy is < 1.5 there.



-- 
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] Sqlalchemy dependency update [airflow]

Posted by "Taragolis (via GitHub)" <gi...@apache.org>.
Taragolis closed pull request #38066: Sqlalchemy dependency update
URL: https://github.com/apache/airflow/pull/38066


-- 
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] Sqlalchemy dependency update [airflow]

Posted by "Taragolis (via GitHub)" <gi...@apache.org>.
Taragolis commented on code in PR #38066:
URL: https://github.com/apache/airflow/pull/38066#discussion_r1524026122


##########
airflow/settings.py:
##########
@@ -273,7 +273,7 @@ def configure_orm(disable_connection_pool=False, pool_class=None):
 
 DEFAULT_ENGINE_ARGS = {
     "postgresql": {
-        "executemany_mode": "values",
+        "executemany_mode": "values_only",

Review Comment:
   Ahhh... I miss this change. Yeah we definitely should keep support of SA 1.4 as much as possible, not all providers could work with SA 2.0
   
   But also I'm not sure that we need to add support SA 2.0, because I'm not totally sure that Airflow could work with it properly.



-- 
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] Sqlalchemy dependency update [airflow]

Posted by "boring-cyborg[bot] (via GitHub)" <gi...@apache.org>.
boring-cyborg[bot] commented on PR #38066:
URL: https://github.com/apache/airflow/pull/38066#issuecomment-1991047739

   Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide (https://github.com/apache/airflow/blob/main/contributing-docs/README.rst)
   Here are some useful points:
   - Pay attention to the quality of your code (ruff, mypy and type annotations). Our [pre-commits]( https://github.com/apache/airflow/blob/main/contributing-docs/08_static_code_checks.rst#prerequisites-for-pre-commit-hooks) will help you with that.
   - In case of a new feature add useful documentation (in docstrings or in `docs/` directory). Adding a new operator? Check this short [guide](https://github.com/apache/airflow/blob/main/docs/apache-airflow/howto/custom-operator.rst) Consider adding an example DAG that shows how users should use it.
   - Consider using [Breeze environment](https://github.com/apache/airflow/blob/main/dev/breeze/doc/README.rst) for testing locally, it's a heavy docker but it ships with a working Airflow and a lot of integrations.
   - Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
   - Please follow [ASF Code of Conduct](https://www.apache.org/foundation/policies/conduct) for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
   - Be sure to read the [Airflow Coding style]( https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#coding-style-and-best-practices).
   - Always keep your Pull Requests rebased, otherwise your build might fail due to changes not related to your commits.
   Apache Airflow is a community-driven project and together we are making it better 🚀.
   In case of doubts contact the developers at:
   Mailing List: dev@airflow.apache.org
   Slack: https://s.apache.org/airflow-slack
   


-- 
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] Sqlalchemy dependency update [airflow]

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on PR #38066:
URL: https://github.com/apache/airflow/pull/38066#issuecomment-1991315807

   > @Taragolis Thanks for your checking. So I see two options
   > 
   > 1. Wait for FAB library to update their dependency or
   > 2. To contribute to their library
   > 
   > Is there another easy way we could follow?
   
   Generally this is the only way to follow. We need somoene (for example you, but can be anyone) to follow up and close all the issues internally (fix all deprecations etc) and nag (or help as you mentioned) everyone who is a blocker to upgrade, and then update all the dependencies (or wait until somoene else does it). Or just wait until they do  - this will happen eventually even without you nagging them. 
   
   Another option of course is to replace the dependencies with others to do the same when we see no option for them to upgrade quickly.
   
   All this is for example what happened when we **just** added Python 3.12.  This one took 5 months till Python 3.12 was released and finally we got it merged yesterday. 
   
   I think a good start (and this is something you could do if you want to make it more progressing) is to create a separate issue named "Sqlalchemy 3 upgrade" where you will track down and list with
   
   * [ ] checkmarks
   
   all the things that need to happen  - and then link (and mark as duplicate) all the issues that refer to it - including the #38064
   
   That would be a very good way to contribute to make that happen eventually. You are most welcome to do that and take a leadership on nagging others and maybe making PRs to fix thins internally.


-- 
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] Sqlalchemy dependency update [airflow]

Posted by "Taragolis (via GitHub)" <gi...@apache.org>.
Taragolis commented on PR #38066:
URL: https://github.com/apache/airflow/pull/38066#issuecomment-1991060437

   https://github.com/apache/airflow/blob/7213fc5b7a5cb9b69fc9f42126f44d214a24b575/pyproject.toml#L136-L139
   
   And we also have a FAB (Flask APP Builder) which also limited by `sqlaclhemy < 1.5`


-- 
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] Sqlalchemy dependency update [airflow]

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on code in PR #38066:
URL: https://github.com/apache/airflow/pull/38066#discussion_r1531807443


##########
airflow/settings.py:
##########
@@ -273,7 +273,7 @@ def configure_orm(disable_connection_pool=False, pool_class=None):
 
 DEFAULT_ENGINE_ARGS = {
     "postgresql": {
-        "executemany_mode": "values",
+        "executemany_mode": "values_only",

Review Comment:
   FAB is being migrated in https://github.com/apache/airflow/pull/38319 -but still sqlalchemy is < 1.5 there.



-- 
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] Sqlalchemy dependency update [airflow]

Posted by "uranusjr (via GitHub)" <gi...@apache.org>.
uranusjr commented on code in PR #38066:
URL: https://github.com/apache/airflow/pull/38066#discussion_r1523751495


##########
airflow/settings.py:
##########
@@ -273,7 +273,7 @@ def configure_orm(disable_connection_pool=False, pool_class=None):
 
 DEFAULT_ENGINE_ARGS = {
     "postgresql": {
-        "executemany_mode": "values",
+        "executemany_mode": "values_only",

Review Comment:
   In that case maybe we don't need to raise the lower version bound, and can make the version range `>=1.4.36,<2.1.0` instead?



-- 
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] Sqlalchemy dependency update [airflow]

Posted by "Taragolis (via GitHub)" <gi...@apache.org>.
Taragolis commented on PR #38066:
URL: https://github.com/apache/airflow/pull/38066#issuecomment-2094514322

   Already fixed in https://github.com/apache/airflow/pull/38362


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