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

Ensure vendor app's sqlalchemy code will not break when Airflow upgrades to sqlalchemy 2.0 #467

Closed
lwrubel opened this issue May 19, 2023 · 1 comment · Fixed by #528
Closed
Assignees
Labels
Airflow Airflow related tickets vendor load part of flask plugin for vendor load "app"

Comments

@lwrubel
Copy link
Contributor

lwrubel commented May 19, 2023

Sqlalchemy 1.4 (current version) has 2.0 query styles and features available, and it doesn't look like we're using 1.4-style select statements, but to make sure we don't introduce anything that might break in an Airflow upgrade, consider:

More docs: https://docs.sqlalchemy.org/en/20/changelog/migration_20.html#the-1-4-2-0-migration-path

@lwrubel lwrubel changed the title Ensure vendor app's sqlalchemy code will not break when Airflow upgrades to to sqlalchemy 2.0 Ensure vendor app's sqlalchemy code will not break when Airflow upgrades to sqlalchemy 2.0 May 19, 2023
@aaron-collier aaron-collier added Airflow Airflow related tickets vendor load part of flask plugin for vendor load "app" labels May 23, 2023
@jmartin-sul jmartin-sul self-assigned this May 31, 2023
jmartin-sul added a commit that referenced this issue May 31, 2023
* via env var in both docker-compose files
* via env var in test.yml CI config

closes #467
@jmartin-sul
Copy link
Member

per standup discussion, i also added this to the prod docker compose config, see #528.

per the suggestion for the airflow project itself in the linked airflow ticket, i also added the env var to our CI test config.

i spun up airflow locally with the new env var, and clicked around the UI, hitting the tabs in various DAGs, and clicking around in the vendor app. looking at my local log output, all the deprecation warnings seemed to be from airflow itself, and not from the vendor app:

libsys-airflow-airflow-init-1  | /home/airflow/.local/lib/python3.10/site-packages/airflow/utils/db.py:992 RemovedIn20Warning: The MetaData.bind argument is deprecated and will be removed in SQLAlchemy 2.0. (Background on SQLAlchemy 2.0 at: https://sqlalche.me/e/b8d9)
libsys-airflow-airflow-init-1  | /home/airflow/.local/lib/python3.10/site-packages/airflow/utils/db.py:1000 RemovedIn20Warning: The ``bind`` argument for schema methods that invoke SQL against an engine or connection will be required in SQLAlchemy 2.0. (Background on SQLAlchemy 2.0 at: https://sqlalche.me/e/b8d9)
libsys-airflow-airflow-init-1  | /home/airflow/.local/lib/python3.10/site-packages/airflow/utils/db.py:1768 RemovedIn20Warning: The connection.execute() method in SQLAlchemy 2.0 will accept parameters as a single dictionary or a single sequence of dictionaries only. Parameters passed as keyword arguments, tuples or positionally oriented dictionaries and/or tuples will no longer be accepted. (Background on SQLAlchemy 2.0 at: https://sqlalche.me/e/b8d9)
libsys-airflow-airflow-init-1  | /home/airflow/.local/lib/python3.10/site-packages/airflow/utils/db.py:1769 RemovedIn20Warning: The connection.execute() method in SQLAlchemy 2.0 will accept parameters as a single dictionary or a single sequence of dictionaries only. Parameters passed as keyword arguments, tuples or positionally oriented dictionaries and/or tuples will no longer be accepted. (Background on SQLAlchemy 2.0 at: https://sqlalche.me/e/b8d9)
libsys-airflow-airflow-init-1  | /home/airflow/.local/lib/python3.10/site-packages/airflow/utils/db.py:1779 RemovedIn20Warning: Passing a string to Connection.execute() is deprecated and will be removed in version 2.0.  Use the text() construct, or the Connection.exec_driver_sql() method to invoke a driver-level SQL string. (Background on SQLAlchemy 2.0 at: https://sqlalche.me/e/b8d9)
libsys-airflow-airflow-init-1  | /home/airflow/.local/lib/python3.10/site-packages/airflow/utils/db.py:1780 RemovedIn20Warning: The connection.execute() method in SQLAlchemy 2.0 will accept parameters as a single dictionary or a single sequence of dictionaries only. Parameters passed as keyword arguments, tuples or positionally oriented dictionaries and/or tuples will no longer be accepted. (Background on SQLAlchemy 2.0 at: https://sqlalche.me/e/b8d9)
libsys-airflow-airflow-init-1  | /home/airflow/.local/lib/python3.10/site-packages/airflow/utils/db.py:992 RemovedIn20Warning: The MetaData.bind argument is deprecated and will be removed in SQLAlchemy 2.0. (Background on SQLAlchemy 2.0 at: https://sqlalche.me/e/b8d9)
libsys-airflow-airflow-init-1  | /home/airflow/.local/lib/python3.10/site-packages/airflow/utils/db.py:1000 RemovedIn20Warning: The ``bind`` argument for schema methods that invoke SQL against an engine or connection will be required in SQLAlchemy 2.0. (Background on SQLAlchemy 2.0 at: https://sqlalche.me/e/b8d9)
libsys-airflow-airflow-init-1  | /home/airflow/.local/lib/python3.10/site-packages/airflow/utils/db.py:992 RemovedIn20Warning: The MetaData.bind argument is deprecated and will be removed in SQLAlchemy 2.0. (Background on SQLAlchemy 2.0 at: https://sqlalche.me/e/b8d9)
libsys-airflow-airflow-init-1  | /home/airflow/.local/lib/python3.10/site-packages/airflow/utils/db.py:1000 RemovedIn20Warning: The ``bind`` argument for schema methods that invoke SQL against an engine or connection will be required in SQLAlchemy 2.0. (Background on SQLAlchemy 2.0 at: https://sqlalche.me/e/b8d9)
libsys-airflow-airflow-init-1       | /home/airflow/.local/lib/python3.10/site-packages/airflow/utils/db.py:992 RemovedIn20Warning: The MetaData.bind argument is deprecated and will be removed in SQLAlchemy 2.0. (Background on SQLAlchemy 2.0 at: https://sqlalche.me/e/b8d9)
libsys-airflow-airflow-init-1       | /home/airflow/.local/lib/python3.10/site-packages/airflow/utils/db.py:1000 RemovedIn20Warning: The ``bind`` argument for schema methods that invoke SQL against an engine or connection will be required in SQLAlchemy 2.0. (Background on SQLAlchemy 2.0 at: https://sqlalche.me/e/b8d9)
libsys-airflow-airflow-init-1       | /home/airflow/.local/lib/python3.10/site-packages/airflow/utils/db.py:1768 RemovedIn20Warning: The connection.execute() method in SQLAlchemy 2.0 will accept parameters as a single dictionary or a single sequence of dictionaries only. Parameters passed as keyword arguments, tuples or positionally oriented dictionaries and/or tuples will no longer be accepted. (Background on SQLAlchemy 2.0 at: https://sqlalche.me/e/b8d9)
libsys-airflow-airflow-init-1       | /home/airflow/.local/lib/python3.10/site-packages/airflow/utils/db.py:1769 RemovedIn20Warning: The connection.execute() method in SQLAlchemy 2.0 will accept parameters as a single dictionary or a single sequence of dictionaries only. Parameters passed as keyword arguments, tuples or positionally oriented dictionaries and/or tuples will no longer be accepted. (Background on SQLAlchemy 2.0 at: https://sqlalche.me/e/b8d9)
libsys-airflow-airflow-init-1       | /home/airflow/.local/lib/python3.10/site-packages/airflow/utils/db.py:1779 RemovedIn20Warning: Passing a string to Connection.execute() is deprecated and will be removed in version 2.0.  Use the text() construct, or the Connection.exec_driver_sql() method to invoke a driver-level SQL string. (Background on SQLAlchemy 2.0 at: https://sqlalche.me/e/b8d9)
libsys-airflow-airflow-init-1       | /home/airflow/.local/lib/python3.10/site-packages/airflow/utils/db.py:1780 RemovedIn20Warning: The connection.execute() method in SQLAlchemy 2.0 will accept parameters as a single dictionary or a single sequence of dictionaries only. Parameters passed as keyword arguments, tuples or positionally oriented dictionaries and/or tuples will no longer be accepted. (Background on SQLAlchemy 2.0 at: https://sqlalche.me/e/b8d9)
libsys-airflow-airflow-init-1       | /home/airflow/.local/lib/python3.10/site-packages/airflow/utils/db.py:992 RemovedIn20Warning: The MetaData.bind argument is deprecated and will be removed in SQLAlchemy 2.0. (Background on SQLAlchemy 2.0 at: https://sqlalche.me/e/b8d9)
libsys-airflow-airflow-init-1       | /home/airflow/.local/lib/python3.10/site-packages/airflow/utils/db.py:1000 RemovedIn20Warning: The ``bind`` argument for schema methods that invoke SQL against an engine or connection will be required in SQLAlchemy 2.0. (Background on SQLAlchemy 2.0 at: https://sqlalche.me/e/b8d9)
libsys-airflow-airflow-init-1       | /home/airflow/.local/lib/python3.10/site-packages/airflow/utils/db.py:992 RemovedIn20Warning: The MetaData.bind argument is deprecated and will be removed in SQLAlchemy 2.0. (Background on SQLAlchemy 2.0 at: https://sqlalche.me/e/b8d9)
libsys-airflow-airflow-init-1       | /home/airflow/.local/lib/python3.10/site-packages/airflow/utils/db.py:1000 RemovedIn20Warning: The ``bind`` argument for schema methods that invoke SQL against an engine or connection will be required in SQLAlchemy 2.0. (Background on SQLAlchemy 2.0 at: https://sqlalche.me/e/b8d9)
libsys-airflow-airflow-webserver-1  | /home/airflow/.local/lib/python3.10/site-packages/airflow/utils/db.py:992 RemovedIn20Warning: The MetaData.bind argument is deprecated and will be removed in SQLAlchemy 2.0. (Background on SQLAlchemy 2.0 at: https://sqlalche.me/e/b8d9)
libsys-airflow-airflow-webserver-1  | /home/airflow/.local/lib/python3.10/site-packages/airflow/utils/db.py:1000 RemovedIn20Warning: The ``bind`` argument for schema methods that invoke SQL against an engine or connection will be required in SQLAlchemy 2.0. (Background on SQLAlchemy 2.0 at: https://sqlalche.me/e/b8d9)
libsys-airflow-airflow-triggerer-1  | /home/airflow/.local/lib/python3.10/site-packages/airflow/utils/db.py:992 RemovedIn20Warning: The MetaData.bind argument is deprecated and will be removed in SQLAlchemy 2.0. (Background on SQLAlchemy 2.0 at: https://sqlalche.me/e/b8d9)
libsys-airflow-airflow-triggerer-1  | /home/airflow/.local/lib/python3.10/site-packages/airflow/utils/db.py:1000 RemovedIn20Warning: The ``bind`` argument for schema methods that invoke SQL against an engine or connection will be required in SQLAlchemy 2.0. (Background on SQLAlchemy 2.0 at: https://sqlalche.me/e/b8d9)
libsys-airflow-airflow-worker-1     | /home/airflow/.local/lib/python3.10/site-packages/airflow/utils/db.py:992 RemovedIn20Warning: The MetaData.bind argument is deprecated and will be removed in SQLAlchemy 2.0. (Background on SQLAlchemy 2.0 at: https://sqlalche.me/e/b8d9)
libsys-airflow-airflow-worker-1     | /home/airflow/.local/lib/python3.10/site-packages/airflow/utils/db.py:1000 RemovedIn20Warning: The ``bind`` argument for schema methods that invoke SQL against an engine or connection will be required in SQLAlchemy 2.0. (Background on SQLAlchemy 2.0 at: https://sqlalche.me/e/b8d9)
libsys-airflow-airflow-scheduler-1  | /home/airflow/.local/lib/python3.10/site-packages/airflow/utils/db.py:992 RemovedIn20Warning: The MetaData.bind argument is deprecated and will be removed in SQLAlchemy 2.0. (Background on SQLAlchemy 2.0 at: https://sqlalche.me/e/b8d9)
libsys-airflow-airflow-scheduler-1  | /home/airflow/.local/lib/python3.10/site-packages/airflow/utils/db.py:1000 RemovedIn20Warning: The ``bind`` argument for schema methods that invoke SQL against an engine or connection will be required in SQLAlchemy 2.0. (Background on SQLAlchemy 2.0 at: https://sqlalche.me/e/b8d9)
libsys-airflow-airflow-triggerer-1  | /home/airflow/.local/lib/python3.10/site-packages/airflow/models/trigger.py:109 RemovedIn20Warning: Using strings to indicate column or relationship paths in loader options is deprecated and will be removed in SQLAlchemy 2.0.  Please use the class-bound attribute directly. (Background on SQLAlchemy 2.0 at: https://sqlalche.me/e/b8d9)
libsys-airflow-airflow-scheduler-1  | /home/airflow/.local/lib/python3.10/site-packages/airflow/jobs/scheduler_job_runner.py:424 RemovedIn20Warning: Using strings to indicate column or relationship paths in loader options is deprecated and will be removed in SQLAlchemy 2.0.  Please use the class-bound attribute directly. (Background on SQLAlchemy 2.0 at: https://sqlalche.me/e/b8d9)

i also ran the tests with the deprecation warning flag, and didn't see any SQLAlchemy 2.0 related deprecation warnings, though i did see some other SQLAlchemy related warnings, also entirely from airflow itself and not the vendor app:

Library/Caches/pypoetry/virtualenvs/libsys-airflow-wuyX_Bf1-py3.10/lib/python3.10/site-packages/airflow/www/app.py:86: DeprecationWarning: The sql_alchemy_conn option in [core] has been moved to the sql_alchemy_conn option in [database] - the old setting has been used, but please update your config.
.pyenv/versions/3.10.7/lib/python3.10/configparser.py:408: DeprecationWarning: The sql_alchemy_conn option in [core] has been moved to the sql_alchemy_conn option in [database] - the old setting has been used, but please update your config.
Library/Caches/pypoetry/virtualenvs/libsys-airflow-wuyX_Bf1-py3.10/lib/python3.10/site-packages/airflow/settings.py:280: DeprecationWarning: The sql_alchemy_pool_enabled option in [core] has been moved to the sql_alchemy_pool_enabled option in [database] - the old setting has been used, but please update your config.
.pyenv/versions/3.10.7/lib/python3.10/configparser.py:408: DeprecationWarning: The sql_alchemy_pool_enabled option in [core] has been moved to the sql_alchemy_pool_enabled option in [database] - the old setting has been used, but please update your config.
Library/Caches/pypoetry/virtualenvs/libsys-airflow-wuyX_Bf1-py3.10/lib/python3.10/site-packages/airflow/settings.py:343: DeprecationWarning: The sql_engine_encoding option in [core] has been moved to the sql_engine_encoding option in [database] - the old setting has been used, but please update your config.
.pyenv/versions/3.10.7/lib/python3.10/configparser.py:408: DeprecationWarning: The sql_engine_encoding option in [core] has been moved to the sql_engine_encoding option in [database] - the old setting has been used, but please update your config.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Airflow Airflow related tickets vendor load part of flask plugin for vendor load "app"
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants