File tree 1 file changed +8
-9
lines changed
1 file changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -166,18 +166,17 @@ won't be prefetching any rows):
166
166
# Postgres requires non-scrollable cursors to be created
167
167
# and used in a transaction.
168
168
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)' )
172
171
173
- # Move the cursor 10 rows forward
174
- await cur.forward(10 )
172
+ # Move the cursor 10 rows forward
173
+ await cur.forward(10 )
175
174
176
- # Fetch one row and print it
177
- print (await cur.fetchrow())
175
+ # Fetch one row and print it
176
+ print (await cur.fetchrow())
178
177
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 ))
181
180
182
181
It's also possible to create cursors from prepared statements:
183
182
You can’t perform that action at this time.
0 commit comments