spine-tools / Spine-Database-API

Database interface to Spine generic data model
https://www.tools-for-energy-system-modelling.org/
GNU Lesser General Public License v3.0
6 stars 5 forks source link

Support sqlalchemy 1.4? #121

Open manuelma opened 3 years ago

manuelma commented 3 years ago

It finally happened. SA 1.4 became release and now our tests are trying to run with that one. At least we'd need to refactor the filter package, since now URL objects are immutable. What do you think @soininen ? Should we just stay at 1.3.x?

It also seems that KeyedTuple is gone but that should be possible to accommodate. Anyways our tests seem to be catching most of the incompatibilities.

soininen commented 3 years ago

Is there any reason to stay with 1.3? I think we should just fix those incompatibilies and be done with it.

manuelma commented 3 years ago

The only reason is to avoid that refactoring and do something else, but you're right, let's do the refactoring.

jkiviluo commented 1 year ago

In the last telco, it sounded like we haven't moved to SQLAlchemy 1.4, but that there could be benefits for doing that. However, it's not urgent, so I'll put this down the road.

PiispaH commented 3 months ago

Status update:

I tried updating to the latest version of SQLAlchemy (2.0.31) and ran the tests. sqlalchemy.util.KeyedTuple needs to be replaced with sqlalchemy.engine.Row. Also conn.execute(some_str) needs to be changed to conn.execute(sqlalchemy.text(some_str)). The last thing I found was that engine.execute() doesn't work and has to be instead connected first:

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

The tests kept on failing and I couldn't see the end of it, so after these modifications I gave up.