github coleifer/peewee 4.0.8

4 hours ago
  • Add BaseQuery.aexecute() - an async twin of execute() available on all query types, executing through the query's bound async database: await User.select().aexecute(), await user.tweets.aexecute(). Returns exactly what execute() returns, including result rows for DML with RETURNING. Queries remain non-awaitable; this is an ordinary coroutine method and the only async method on queries.
  • Add async model methods to playhouse.pwasyncio using "a"-prefixed coroutine counterparts of the row-level Model methods (acreate, aget, aget_or_none, aget_by_id, aget_or_create, aset_by_id, adelete_by_id, abulk_create, abulk_update, asave, adelete_instance), available via the new AsyncModel / AsyncModelMixin classes. Each is a thin delegation through the greenlet bridge, so behavior is identical to the synchronous implementation. Note: the Model property of async databases now returns a base class that includes these methods - relevant only if you introspect the base class of db.Model subclasses.
  • Add afetch() for explicit, awaitable lazy foreign-key resolution: user = await tweet.afetch(Tweet.user). Already-loaded relations (via join or prefetch) return immediately without a query.
  • Add db.first(query, n=1) async helper.
  • MissingGreenletBridge errors now include a hint describing the async APIs to use.
  • The asyncio extension is no longer considered preliminary - the async APIs documented in the docs are stable. The asyncio stress test now also runs in CI.

View commits
quay-000

Don't miss a new peewee release

NewReleases is sending notifications on new releases.