tortoise / tortoise/tortoise-orm

Testing with multiple database

Open
#816 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
5.6k
Forks
516
Avg merge
2d 21h
Merged PRs (30d)
9

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue through the reported initializer(...) and request.addfinalizer(finalizer) calls, using different db_url values and model modules. Trace how repeated initialization replaces the prior database state. Done means the issue's multiple-database setup can initialize and generate schemas without one database overriding another.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
databases
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.