tortoise / tortoise/tortoise-orm
Auto discover models recursively
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 5.6k
- Forks
- 516
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 9
Description
Problem
For now, we need to specify explicitly from which modules Tortoise finds models, but not submodules, recursively.
In the example below, Tortoise loads models from models module, but not models.users or models.users.customers.
tortoise_config = {
"connections": {"default": DATABASE_URI},
"apps": {
"models": {
"models": ["models", "aerich.models"]
}
},
}
Proposed Solutions
- Support
"models": ["models.*", "aerich.models"]syntax. - Add another flag to discover models recursively.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the configuration handling for the apps.models.models entries shown in the example, and trace how a module is currently discovered. Resolve whether wildcard syntax or a recursive-discovery flag is the intended API, then define behavior for nested modules such as models.users.customers. Done means the selected API discovers models recursively while preserving explicit entries such as aerich.models.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100