Among the many changes we switch to using SQLAlchemy's connection pool,
which means we are no longer required to guard against multiple threads
working on the database.
All db funcs now receive a connection to use as their first argument,
this allows the caller to control transaction & rollback behavior.
This includes only the most basic steps of the upgrade, to make the
existing code run with Python 3.12. No refactoring to make use of new
features is included.