I have an assortment of similar (but not identical) databases, and would like to use SQLAlchemy as a way to \"standardize\" access. The databases can differ very slightly, such
Your solution looks pretty good. Here's what I did.
I have a package named connectors, and in it a module for each db as well as a settings file.
Each of these connector modules creates its connection string and its engine, along with the declarative base and classes for the tables.
Then there is a method loadSession that returns the session (this one I got from a tutorial or another post here somewhere, cant recall exactly) and another one I added that returns the engine in case I want to do something with that.
So then in some other module of the program, I would do something like this
from connectors import x, y, z
x_ses = x.loadSession()
y_ses = y.loadSession()
z_ses = z.loadSession()
xq = x_ses.query(...)
yq = y_ses.query(...)