DEP0009/ORM and backward-compatibility

One option would to fall back to the current sync_to_async behavior when we don’t have an async connection, emitting a PendingDeprecationWarning.

Something like:

class QuerySet:
    ....

    async def aexists(self):
        try:
            return await <async_implentation>
        except MissingAsyncConnection:
            warnings.warn("...")
            return await sync_to_async(self.exists)()
2 Likes