tortoise / tortoise-orm

Familiar asyncio ORM for python, built with relations in mind
https://tortoise.github.io
Apache License 2.0
4.7k stars 391 forks source link

Testing with multiple database #816

Open Azharsayyed5 opened 3 years ago

Azharsayyed5 commented 3 years ago

Hi,

I would like to inform and request that please add testing with multiple database, as in my case, my application is using two database but I can only intialize and generate schema for one at a time, if I again call initializer function previous database will be overidden.

initializer(["tests.testmodels"], db_url=db_url, app_label="models") request.addfinalizer(finalizer)

The thing is even if I call above function multiple times with different models of different database, it is getting override.

Please let me know the solution if already there

lsabi commented 3 years ago

Can you elaborate further? Do you want to test with databases of different brands (e.g. Postgres and mysql) or with two separate databases of the same brand (e.g. Postgres and Postgres)?