演说家ORM:如何改变数据库?

2024-09-26 22:07:39 发布

您现在位置:Python中文网/ 问答频道 /正文

在演说家documentation上,我只能找到改变联系的方法。我已经检查过演说家Connection Model,但是找不到数据库设置器。你知道吗

有没有一种方法可以在不创建多个连接的情况下更改Orator ORM上的数据库?非常感谢。你知道吗

Github问题链接:https://github.com/sdispater/orator/issues/326


Tags: 方法httpsgithubcom数据库model链接documentation
1条回答
网友
1楼 · 发布于 2024-09-26 22:07:39

josephmancuso在github上回答了这个问题:

No. You'll need to switch between the connections.

A connection is just a group of database settings.

从技术上讲,如果手动查询,您可以这样做,但这忽略了使用ORM的全部好处:

db.select('select * from db2.table') #runs a raw query

相关问题 更多 >

    热门问题