VForWaTer / metacatalog

Modular metadata management platform for environmental data.
https://vforwater.github.io/metacatalog
GNU General Public License v3.0
3 stars 1 forks source link

SQLAlchemy 2.0 migration #240

Open AlexDo1 opened 1 year ago

AlexDo1 commented 1 year ago

SQLAlchemy 2.0 was released, introducing a lot of breaking changes.
We need to adapt metacatalog where SQLAlchemy is used to make metacatalog compatible to SQLAlchemy 2.0. There is an official migration guide by SQLAlchemy: https://docs.sqlalchemy.org/en/14/changelog/migration_20.html

Important:

Currently (27.01.2023), pandas is also not compatible to SQLAlchemy 2.0, as described in this issue: https://github.com/pandas-dev/pandas/issues/40686.

mmaelicke commented 1 year ago

Beside the use of Session.bind in pandas, I think we should be able to substitute all usages of:

with engine.connect() as con:
    con.execute(...)

with:

session.execute(...)

In the older versions there have been differences how the transaction is handled, we need to check the changelog to see if that is still the case in 2.0 and how it affects our code.