MCPcopy
hub / github.com/psycopg/psycopg / executemany

Method executemany

psycopg/psycopg/cursor_async.py:120–148  ·  view source on GitHub ↗

Execute the same command with a sequence of input data.

(
        self, query: Query, params_seq: Iterable[Params], *, returning: bool = False
    )

Source from the content-addressed store, hash-verified

118 return self
119
120 async def executemany(
121 self, query: Query, params_seq: Iterable[Params], *, returning: bool = False
122 ) -> None:
123 """
124 Execute the same command with a sequence of input data.
125 """
126 try:
127 async with self._conn.lock:
128 if AsyncPipeline.is_supported():
129 # If there is already a pipeline, ride it, in order to avoid
130 # sending unnecessary Sync.
131 if self._conn._pipeline:
132 await self._conn.wait(
133 self._executemany_gen_pipeline(query, params_seq, returning)
134 )
135 # Otherwise, make a new one
136 else:
137 async with self._conn._pipeline_nolock():
138 await self._conn.wait(
139 self._executemany_gen_pipeline(
140 query, params_seq, returning
141 )
142 )
143 else:
144 await self._conn.wait(
145 self._executemany_gen_no_pipeline(query, params_seq, returning)
146 )
147 except e._NO_TRACEBACK as ex:
148 raise ex.with_traceback(None)
149
150 async def stream(
151 self,

Callers

nothing calls this directly

Calls 5

is_supportedMethod · 0.80
waitMethod · 0.45
_pipeline_nolockMethod · 0.45

Tested by

no test coverage detected