SeitaBV / timely-beliefs

Model data as beliefs (at a certain time) about events (at a certain time).
MIT License
33 stars 6 forks source link

Support SQLAlchemy 2.0.x #160

Closed Ahmad-Wahid closed 8 months ago

Ahmad-Wahid commented 8 months ago

In this pull request, I've advanced the SQLAlchemy version from 1.3.19 to 2.0.0 and adjusted the queries to adhere to the 2.0.x format. I have used pytest to test all the new changes.

References:

Flix6x commented 8 months ago

Great work!

I noticed that this PR constitutes a breaking change, as timely-beliefs will effectively require SQLAlchemy>=2. We can make that explicit in the pyproject.toml.

But before we do so, I want to ask @nhoening whether we'd need to (or prefer to) support both major versions for a while? My thought is that we'd accept breaking support for SQLAlchemy<2, and release as timely-beliefs==2. Then pip's dependency resolver should pick up on any compatibility issues. And if needed, we can always backport new tb features to the 1.x branch.

nhoening commented 8 months ago

I agree with the plan.

It is not a classic breaking change, unless someone needs to use SQLAlchemy<2 for some reason.

Nevertheless, a good time to move TB to v2

Ahmad-Wahid commented 8 months ago

I would want to test this when flexmeasures support sqlalchemy==2.0 to see how fast the data is going to be loaded.

Flix6x commented 8 months ago

Locally I didn't notice much of a difference, but let me know if you need anything from me to do this test properly (such as a dev release).