Are there Python ORMs that support multiple independent databases at the same time?

I am writing a Python application where I would like to use sqlite as a repository for documents edited by the application, with documents that are usually stored in memory but saved to disk databases when the application is saved.

Ideally, I would like to use something like ORM to easily access data from my Python application code. Unfortunately, it seems that most Python ORMs, including SQLAlchemy, SQLObject, Django, and Storm, associate a database connection (or an engine or something else) with classes that represent table data, rather than instances of these classes. This limits these ORMs to working with a single database connection in all instances. Since I would like to support multiple documents opening simultaneously, this will not work for me.

Are there ORMs that support this usage model in Python? Bazaar seems to support this, but it is completely outdated and at first glance seems to have some other flaws.

Thanks for any suggestions!

+3
source share
2 answers

The upcoming version of django 1.2 supports this.

Here is his description: http://djangoadvent.com/1.2/multiple-database-support/

+3
source

SQLAlchemy supports multiple database connections for each class, as in this example: http://svn.sqlalchemy.org/sqlalchemy/trunk/examples/sharding/attribute_shard.py

+3
source

Source: https://habr.com/ru/post/1739723/


All Articles