Q. Can I use more than one database handle with TurboGears ?
- You sure can! At least with SQLalchemy
Configure your .cfg file
handle_a.sqlalchemy.dburi="postgres://database=dba&host=localhost&user=usera&password=abc" handle_b.sqlalchemy.dburi="postgres://database= dba&host=localhost&user= userb&password=xyz"
Configure your model.py
engine_a = __engine_a__ = PackageEngine("handle_a") engine_b = __engine_b__ = PackageEngine("handle_b")
Then just instantiate tables / classes using engine_a or engine_b
What about having the same class read using one handle ( readonly slave db ) and write using another ( writing master )?
someone else will have to answer that one. let me know when you figure it out!