Skip to content

[Question] Cursor docs #475

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
lynxknight opened this issue Sep 11, 2019 · 1 comment
Closed

[Question] Cursor docs #475

lynxknight opened this issue Sep 11, 2019 · 1 comment

Comments

@lynxknight
Copy link

async with con.transaction():

Or, alternatively, you can iterate over the cursor manually (cursor won't be prefetching any rows):

async def iterate(con: Connection):
    async with con.transaction():
        # Postgres requires non-scrollable cursors to be created
        # and used in a transaction.

        async with con.transaction():
            # Create a Cursor object
            cur = await con.cursor('SELECT generate_series(0, 100)')

I don't undestand why nested transaction is necessary here. Can someone elaborate?

@elprans elprans closed this as completed in 32fccaa Oct 3, 2019
@elprans
Copy link
Member

elprans commented Oct 3, 2019

No reason. That was copy-paste. Thanks for noticing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants