Fix SAWarnings #7

Merged
alexander merged 4 commits from fix-sawarnings into develop 2026-11-30 11:05:12 +01:00
Showing only changes of commit e01421bb96 - Show all commits

Close the connection after running the migrations

The pooled `connection` stayed open until garbage collection,
which emits a `ResourceWarning`
Alexander Hess 2026-11-30 10:54:22 +01:00
Signed by: alexander
GPG key ID: B46EDB4DFC26805D

View file

@ -31,7 +31,8 @@ def include_object(obj, _name, type_, _reflected, _compare_to):
return True
engine = sa.create_engine(velofy_config.DATABASE_URI)
# Without a `pool`, the `connection` really closes after the migrations
engine = sa.create_engine(velofy_config.DATABASE_URI, poolclass=sa.pool.NullPool)
test_schema = f"_{velofy_config.CLEAN_SCHEMA}" if os.getenv("TESTING") else ""