PonyORM

时间:2019-02-15 10:09:44

标签: python sqlite ponyorm

我目前正在使用PonyORM访问python中的SQLite数据库。像这样:

@db_session
def dowork:
    lots of database things done here

我现在需要访问另一个完全独立的SQLite数据库。不幸的是,两个数据库之间的访问模式是完全分开的,当我处于第一个db_session时,我需要在第二个数据库上创建表:

@db_session
def dowork:
    lots of database things done here
    can't create a second SQLite database here because we're in a db_session

是否可以为不同的数据库定义不同的会话?在保持代码逻辑的同时,我无法重构工作流程。我目前只能看到的唯一选择是不对其中一个数据库使用PonyORM。

0 个答案:

没有答案
相关问题