Closed erhuabushuo closed 5 months ago
The only existing support you have for this today is defining a subclass for every database instance you want to support, eg:
from emmett.orm import Model, Field
class MyModel(Model):
tablename = "mymodel"
foo = Field()
class MyReadModel(MyModel):
...
class MyWriteModel(MyModel):
...
dbr.define_models(MyReadModel)
dbw.define_models(MyWriteModel)
Thanks a lot.
In a database master-slave , I need define same models with two databases. How can I specify which connection when I query by using Model