We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Describe the bug When I prefetch_related() a model that has JSON lists (instead of JSON dicts) I get TypeError.
To Reproduce
class Album(ormar.Model): ormar_config = base_ormar_config.copy(tablename="albums") id: int = ormar.Integer(primary_key=True) name: str = ormar.String(max_length=100, nullable=True) shops: List[Shop] = ormar.ManyToMany(to=Shop, through=AlbumShops) sides: list = ormar.JSON(default=list)
track = await Track.objects.prefetch_related( ["album__cover_pictures", "album__shops__division"] ).get(title="The Bird")
error:
@pytest.mark.asyncio async def test_prefetch_related_with_many_to_many(): async with base_ormar_config.database: async with base_ormar_config.database.transaction(force_rollback=True): div = await Division.objects.create(name="Div 1") shop1 = await Shop.objects.create(name="Shop 1", division=div) shop2 = await Shop.objects.create(name="Shop 2", division=div) album = Album(name="Malibu") await album.save() await album.shops.add(shop1) await album.shops.add(shop2) await Track.objects.create(album=album, title="The Bird", position=1) await Track.objects.create( album=album, title="Heart don't stand a chance", position=2 ) await Track.objects.create(album=album, title="The Waters", position=3) await Cover.objects.create(title="Cover1", album=album, artist="Artist 1") await Cover.objects.create(title="Cover2", album=album, artist="Artist 2") > track = await Track.objects.prefetch_related( ["album__cover_pictures", "album__shops__division"] ).get(title="The Bird") tests\test_relations\test_prefetch_related.py:381:
Expected behavior It should support JSON dicts and lists, not just dicts
Screenshots
Versions (please complete the following information):
ormar
pydantic
fastapi
Additional context
The text was updated successfully, but these errors were encountered:
@jannyware-inc Did you manage to find a workaround?
Sorry, something went wrong.
No branches or pull requests
Describe the bug
When I prefetch_related() a model that has JSON lists (instead of JSON dicts) I get TypeError.
To Reproduce
error:
Expected behavior
It should support JSON dicts and lists, not just dicts
Screenshots

Versions (please complete the following information):
aiosqlite
3.12
ormar
version-0.20.1
pydantic
versionpydantic==2.5.3
pydantic-extra-types==2.9.0
pydantic_core==2.14.6
fastapi
versionfastapi==0.111.0
fastapi-cli==0.0.4
Additional context
The text was updated successfully, but these errors were encountered: