@@ -264,6 +264,63 @@ async def main() -> None:
264264 await transaction.rollback()
265265```
266266
267+ ### Transaction execute many
268+
269+ You can execute one statement with multiple pararmeters.
270+ The query will be executed with all parameters or will not be executed at all.
271+
272+ ``` python
273+ from typing import Any
274+
275+ from psqlpy import PSQLPool, IsolationLevel
276+
277+
278+ db_pool = PSQLPool()
279+
280+ async def main () -> None :
281+ await db_pool.startup()
282+
283+ connection = await db_pool.connection()
284+ transaction = connection.transaction(
285+ isolation_level = IsolationLevel.Serializable,
286+ )
287+
288+ await transaction.begin()
289+ await transaction.execute_many(
290+ " INSERT INTO users VALUES ($1)" ,
291+ [[" first-data" ], [" second-data" ], [" third-data" ]],
292+ )
293+ await transaction.commit()
294+ ```
295+
296+ ### Transaction fetch row
297+
298+ You can fetch first row.
299+
300+ ``` python
301+ from typing import Any
302+
303+ from psqlpy import PSQLPool, IsolationLevel
304+
305+
306+ db_pool = PSQLPool()
307+
308+ async def main () -> None :
309+ await db_pool.startup()
310+
311+ connection = await db_pool.connection()
312+ transaction = connection.transaction(
313+ isolation_level = IsolationLevel.Serializable,
314+ )
315+
316+ await transaction.begin()
317+ first_row = await transaction.fetch_row(
318+ " SELECT * FROM users WHERE user_id = $1" ,
319+ [" user-id" ],
320+ )
321+ first_row_result = first_row.result() # This will be a dict.
322+ ```
323+
267324### Transaction ROLLBACK TO SAVEPOINT
268325
269326You can rollback your transaction to the specified savepoint, but before it you must create it.
0 commit comments