Are there Python ORMs out there that support multiple independent databases concurrently in use?
I'm writing an application in Python where I wish to use sqlite as the backing store for documents edited by the app, with documents generally living in memory, but being saved to disk-based databases when the application saves.
Ideally I'd like to use something like an ORM to make access to the data from my Python application code simple. Unfortunately it seems like the majority of Python ORMs, including SQLAlchemy, SQLObj开发者_运维问答ect, Django, and Storm, associate the database connection (or engine or whatever) with the classes representing table data, rather than instances of those classes. This restricts these ORMs to working with a single database connection across all instances. Since I'd like to support having multiple documents open simultaneously, this isn't going to work for me.
Are there any ORMs out there that support this usage model in Python? Bazaar seems to support this, but it's quite out of date, and at first glance appears to have some other shortcomings.
Thanks for any suggestions!
The upcoming django 1.2 release supports this.
Here's a description of it: http://djangoadvent.com/1.2/multiple-database-support/
SQLAlchemy does support multiple database connections per class, as in this example: http://svn.sqlalchemy.org/sqlalchemy/trunk/examples/sharding/attribute_shard.py
精彩评论