MCPcopy
hub / github.com/MagicStack/asyncpg / executemany

Method executemany

asyncpg/connection.py:366–401  ·  view source on GitHub ↗

Execute an SQL *command* for each sequence of arguments in *args*. Example: .. code-block:: pycon >>> await con.executemany(''' ... INSERT INTO mytab (a) VALUES ($1, $2, $3); ... ''', [(1, 2, 3), (4, 5, 6)]) :param command: Command

(
        self,
        command: str,
        args,
        *,
        timeout: typing.Optional[float]=None,
    )

Source from the content-addressed store, hash-verified

364 return status.decode()
365
366 async def executemany(
367 self,
368 command: str,
369 args,
370 *,
371 timeout: typing.Optional[float]=None,
372 ):
373 """Execute an SQL *command* for each sequence of arguments in *args*.
374
375 Example:
376
377 .. code-block:: pycon
378
379 >>> await con.executemany('''
380 ... INSERT INTO mytab (a) VALUES ($1, $2, $3);
381 ... ''', [(1, 2, 3), (4, 5, 6)])
382
383 :param command: Command to execute.
384 :param args: An iterable containing sequences of arguments.
385 :param float timeout: Optional timeout value in seconds.
386 :return None: This method discards the results of the operations.
387
388 .. versionadded:: 0.7.0
389
390 .. versionchanged:: 0.11.0
391 `timeout` became a keyword-only parameter.
392
393 .. versionchanged:: 0.22.0
394 ``executemany()`` is now an atomic operation, which means that
395 either all executions succeed, or none at all. This is in contrast
396 to prior versions, where the effect of already-processed iterations
397 would remain in place when an error has occurred, unless
398 ``executemany()`` was called in a transaction.
399 """
400 self._check_open()
401 return await self._executemany(command, args, timeout)
402
403 async def _get_statement(
404 self,

Callers

nothing calls this directly

Calls 2

_check_openMethod · 0.95
_executemanyMethod · 0.95

Tested by

no test coverage detected