MCPcopy Create free account
hub / github.com/MagicStack/asyncpg / executemany

Method executemany

asyncpg/connection.py:389–424  ·  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

387 return status.decode()
388
389 async def executemany(
390 self,
391 command: str,
392 args,
393 *,
394 timeout: typing.Optional[float]=None,
395 ):
396 """Execute an SQL *command* for each sequence of arguments in *args*.
397
398 Example:
399
400 .. code-block:: pycon
401
402 >>> await con.executemany('''
403 ... INSERT INTO mytab (a) VALUES ($1, $2, $3);
404 ... ''', [(1, 2, 3), (4, 5, 6)])
405
406 :param command: Command to execute.
407 :param args: An iterable containing sequences of arguments.
408 :param float timeout: Optional timeout value in seconds.
409 :return None: This method discards the results of the operations.
410
411 .. versionadded:: 0.7.0
412
413 .. versionchanged:: 0.11.0
414 `timeout` became a keyword-only parameter.
415
416 .. versionchanged:: 0.22.0
417 ``executemany()`` is now an atomic operation, which means that
418 either all executions succeed, or none at all. This is in contrast
419 to prior versions, where the effect of already-processed iterations
420 would remain in place when an error has occurred, unless
421 ``executemany()`` was called in a transaction.
422 """
423 self._check_open()
424 return await self._executemany(command, args, timeout)
425
426 async def _get_statement(
427 self,

Callers

nothing calls this directly

Calls 2

_check_openMethod · 0.95
_executemanyMethod · 0.95

Tested by

no test coverage detected