tortoise / tortoise/tortoise-orm
Question about .select_related() and .values()
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 5.6k
- Forks
- 516
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 9
Description
Hi ! I'm trying to use .select_related() with .values() but this is not working as I expected.
When I do :
MyModel.all().select_related('meta').values()
The "meta" values don't appear in the results :
# What I get :
[
{
"id": 1,
"name": "..."
}
]
# What I need :
[
{
"id": 1,
"name": "...",
"_meta": {
...
}
}
]
Is this normal ?
Any way to use it without defining columns in .values() like : .values('id', 'meta__id') ?
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
No source file, test, or entry point is named. Reproduce the Python ORM query using select_related() and values(), then inspect the query-building behavior to determine the intended result shape. Done requires a confirmed behavior or a clearly specified change with tests for related values.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- database
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100