Closed horlahlekhon closed 5 years ago
You need to await
the Queryset to get the objects. Tortoise is an async framework, and we can only do I/O when you cede control of the I/O loop.
So do an await Messages.filter(message_id=message_id).first()
instead.
If the documentation is not making it clear enough that one has to use await
could you please point me to the docs you looked at so I can make it clearer?
Thanks very much, i didnt wait it , it has retruned the object now.
on a side note , is there a way to use alembic with tortoise-orm or is there a migration package. thanks.
A pleasure.
Unfortunately Alembic is very SQLAlchemy specific. We don't currently have a formal migration system in place for Tortoise-ORM. There is an open ticket #8 and a workaround here: https://github.com/tortoise/tortoise-orm/issues/8#issuecomment-534946871
The plan is to get Tortoise-ORM feature complete to a production level (v1.0, see #19) and then we will look at the next round of work, which is likely to include migrations, better SerDes...
Hi, i cant seem to be able to get the underlying object when i either
get
orfilter
what i get back is aQuerySet
.tortoise-orm version : 0.13.12
python version : 3.7
example:
this was supposed to return the underlying message object according to the documentation, but i still get query set.
please what am i doing wrong.