Describe the bug
I'm trying to get a single field from a filtered set of rows.
I've tried the following:
branches = await ProjectDependency.objects.filter(project__id=project_id).values_list(fields=["git_branch"])
branches = await ProjectDependency.objects.filter(project__id=project_id).fields("git_branch").values_list()
But they both return other columns as well as git_branch:
[
[
"develop",
1,
"project name A",
"project code A",
1,
"platform A"
],
[
"",
1,
"project name B",
"project code B",
1,
"platform B"
]
]
If I add flatten=True, it works correctly:
branches = await ProjectDependency.objects.filter(project__id=project_id).values_list(fields=["git_branch"], flatten=True)
Is this intentional? Maybe I'm missing something.
I would expect the version without flatter to return this:
Versions (please complete the following information):
- Database backend used: sqlite
- Python version: 3.8
ormar version: 0.11.2
pydantic version: 1.9.1
- if applicable
fastapi version: 0.79.0
Describe the bug
I'm trying to get a single field from a filtered set of rows.
I've tried the following:
But they both return other columns as well as
git_branch:[ [ "develop", 1, "project name A", "project code A", 1, "platform A" ], [ "", 1, "project name B", "project code B", 1, "platform B" ] ]If I add
flatten=True, it works correctly:Is this intentional? Maybe I'm missing something.
I would expect the version without flatter to return this:
Versions (please complete the following information):
ormarversion: 0.11.2pydanticversion: 1.9.1fastapiversion: 0.79.0