decimal.Decimal breaks JsonModel.find()
zidokobik opened this issue · 0 comments
zidokobik commented
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 = 'example@example.com'
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 ?