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

Method executemany

psycopg/psycopg/cursor.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 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 with self._conn.lock:
128 if Pipeline.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 self._conn.wait(
133 self._executemany_gen_pipeline(query, params_seq, returning)
134 )
135 else:
136 # Otherwise, make a new one
137 with self._conn._pipeline_nolock():
138 self._conn.wait(
139 self._executemany_gen_pipeline(
140 query, params_seq, returning
141 )
142 )
143 else:
144 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 def stream(
151 self,

Callers 15

workFunction · 0.45
test_copy_table_acrossFunction · 0.45
workFunction · 0.45
workFunction · 0.45
test_executemanyMethod · 0.45
test_executemanyMethod · 0.45
workFunction · 0.45
workFunction · 0.45

Calls 5

is_supportedMethod · 0.80
waitMethod · 0.45
_pipeline_nolockMethod · 0.45

Tested by 15

workFunction · 0.36
test_copy_table_acrossFunction · 0.36
workFunction · 0.36
workFunction · 0.36
test_executemanyMethod · 0.36
test_executemanyMethod · 0.36
workFunction · 0.36
workFunction · 0.36