klen / peewee-aio

Async support for Peewee ORM
44 stars 7 forks source link

get_by_id_or_none #3

Closed vitidev closed 2 years ago

vitidev commented 2 years ago

Need this feature

Of course I can use

 await manager.get_or_none(Model, Model.id == id)

but for this I need to have manager in place

or something like get_by_id(Model, pk, raise_non_exists=True) because the name get_by_id_or_none is just awful

klen commented 2 years ago

The library follows API from peewee and only provides async support. Peewee has two similar methods: get_or_none and get_by_id. Both of the methods are supported by AIOModel. I don't think that we have to expand peewee interface more than needed.