Skip to content

Commit 32fccaa

Browse files
committed
Remove superfluous transaction from a cursor example
Closes: #475
1 parent 5513b9d commit 32fccaa

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

docs/api/index.rst

+8-9
Original file line numberDiff line numberDiff line change
@@ -166,18 +166,17 @@ won't be prefetching any rows):
166166
# Postgres requires non-scrollable cursors to be created
167167
# and used in a transaction.
168168
169-
async with con.transaction():
170-
# Create a Cursor object
171-
cur = await con.cursor('SELECT generate_series(0, 100)')
169+
# Create a Cursor object
170+
cur = await con.cursor('SELECT generate_series(0, 100)')
172171
173-
# Move the cursor 10 rows forward
174-
await cur.forward(10)
172+
# Move the cursor 10 rows forward
173+
await cur.forward(10)
175174
176-
# Fetch one row and print it
177-
print(await cur.fetchrow())
175+
# Fetch one row and print it
176+
print(await cur.fetchrow())
178177
179-
# Fetch a list of 5 rows and print it
180-
print(await cur.fetch(5))
178+
# Fetch a list of 5 rows and print it
179+
print(await cur.fetch(5))
181180
182181
It's also possible to create cursors from prepared statements:
183182

0 commit comments

Comments
 (0)