edgedb / edgedb-python

The official Python client library for EdgeDB
https://edgedb.com
Apache License 2.0
369 stars 45 forks source link

add atomic iteration option to codegen #386

Closed TomFaulkner closed 2 years ago

TomFaulkner commented 2 years ago

Adds atomic transactions option to change client to transaction iteration.

This and similar for blocking:

if self._atomic:
    print(f"{INDENT}transaction: edgedb.asyncio_client.AsyncIOIteration,", file=buf)
else:
    print(f"{INDENT}client: edgedb.AsyncIOClient,", file=buf)
fantix commented 2 years ago

Thanks for the PR! I'm thinking we should probably do something like this instead:

async def my_query(
    executor: edgedb.AsyncIOExecutor,
    ...
) -> MyQueryResult:
    return await executor.query_single(...)

So that both AsyncIOClient and AsyncIOIteration (transaction) are supported.