-
source db is distributed env ,
ormar module db_b
Target db is similar 2 db. I'd like to join the 2 modules into single module so i could use for read/write data easily. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
I'm not sure if I follow, but if you ask what i think you ask you can: either rename the models to reflect the module: class TestA(ormar.Model): # different name
class Meta(BaseMetaDB_a):
tablename: str = "test"
id: int = ormar.Integer(primary_key=True)
some_key: int = ormar.Integer() ormar module db_b class TestB(ormar.Model): # different name
class Meta(BaseMetaDB_b):
tablename: str = "test"
id: int = ormar.Integer(primary_key=True)
some_key: int = ormar.Integer() other app module: from module_a import TestA
from module_b import TestB
# the names differ
await TestA().save()
await TestB().save() or if you don't wont to rename the classes simply import the whole module and use qualified names: other app module: import module_a
import module_b
# use name with module prefix
await module_a.Test().save()
await module_b.Test().save() BTW. can you use language setting when you paste code here - it's easier to read when github adjusts the colors etc. |
Beta Was this translation helpful? Give feedback.
I'm not sure if I follow, but if you ask what i think you ask you can:
either rename the models to reflect the module:
ormar module db_b
other app module:
or if you don't wont to rename the classes simply im…