Skip to content
New issue

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

decimal.Decimal breaks JsonModel.find() #654

Open
zidokobik opened this issue Sep 4, 2024 · 0 comments
Open

decimal.Decimal breaks JsonModel.find() #654

zidokobik opened this issue Sep 4, 2024 · 0 comments

Comments

@zidokobik
Copy link

zidokobik commented Sep 4, 2024

Consider the following code:

import asyncio
from decimal import Decimal
from aredis_om import JsonModel, Field, Migrator


class Book(JsonModel):
	author : str = Field(index=True)
	pages : Decimal = Field(index=True, default=Decimal('0'))


async def main():
	await Migrator().run()

	author = '[email protected]'
	book = Book(author=author)
	await book.save()

	query = await Book.find(Book.author == author).all()
	print(query)  # []

	
if __name__ == "__main__":
	with asyncio.Runner() as runner:
		runner.run(main())

query should not be empty.

Version:
redis==4.6.0
redis-om==0.3.2
pydantic==2.8.2

Removing the Decimal field works as normal, so as using HashModel. Is this a bug ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant