Skip to content

Commit

Permalink
Remove superfluous transaction from a cursor example
Browse files Browse the repository at this point in the history
Closes: #475
  • Loading branch information
elprans committed Oct 3, 2019
1 parent 5513b9d commit 32fccaa
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions docs/api/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -166,18 +166,17 @@ won't be prefetching any rows):
# 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)')
# Create a Cursor object
cur = await con.cursor('SELECT generate_series(0, 100)')
# Move the cursor 10 rows forward
await cur.forward(10)
# Move the cursor 10 rows forward
await cur.forward(10)
# Fetch one row and print it
print(await cur.fetchrow())
# Fetch one row and print it
print(await cur.fetchrow())
# Fetch a list of 5 rows and print it
print(await cur.fetch(5))
# Fetch a list of 5 rows and print it
print(await cur.fetch(5))
It's also possible to create cursors from prepared statements:

Expand Down

0 comments on commit 32fccaa

Please sign in to comment.