Currently, I'm instantiating a new engine and declarative automap base for
each MySQL database I'd like to include in my session and then individually
mapping reflected tables to the relevant engines. Some sample code to
report_engine = create_engine(URL(drivername='mysql',
report_base = automap_base()
md_engine = create_engine(URL(drivername='mysql',
md_base = automap_base()
# map tables to classes
user_practice_contacts = md_base.classes.user_practice_contacts
user_professional_details = md_base.classes.user_professional_details
users = report_base.classes.users
cities = report_base.classes.cities
sess = scoped_session(sessionmaker(twophase=True,
This seems like a hack-ish approach so I'm wondering if there's a better
way. Must a separate engine and base be created for each MySQL DB? Each DB
resides on the same MySQL instance with the same host name. And must each
table be explicitly bound in the session creation? Still learning the ropes
of SQLAlchemy so forgive me if these are obvious questions. Thanks for your
You received this message because you are subscribed to the Google Groups
To unsubscribe from this group and stop receiving emails from it, send an email
To post to this group, send email to email@example.com.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.