self, crud_params, returning_clause_exists):
# Currently not using psycopg2.execute_values() when there's a returning clause; need to add support
# for receiving multiple return values from insert query
- if self.multiple_rows and not returning_clause_exists and self.dialect.psycopg2_batch_mode == 'execute_values':
+ if self.multiple_rows and not returning_clause_exists and self.dialect.psycopg2_execution_mode == 'values_batch':
self.execute_values_insert_template = "(" + \
", ".join([c[1] for c in crud_params]) + ")"
return " VALUES %s"
return None
def do_executemany(self, cursor, statement, parameters, context=None):
- if self.psycopg2_execution_mode == 'single_insert':
+ if self.psycopg2_execution_mode == 'single_statement':
cursor.executemany(statement, parameters)
elif self.psycopg2_execution_mode == 'values_batch' and \
context and \
def setup(self):
super(ExecuteBatchInsertsTest, self).setup()
- self.engine = engines.testing_engine(options={"use_batch_mode": True})
+ self.engine = engines.testing_engine(options={"execution_mode": "statements_batch"})
def teardown(self):
self.engine.dispose()
def setup(self):
super(ExecuteValuesInsertsTest, self).setup()
self.engine = engines.testing_engine(
- options={"use_batch_mode": "execute_values"})
+ options={"execution_mode": "values_batch"})
def teardown(self):
self.engine.dispose()
assert argslist == ({'x': 'x1', 'y': 'y1'}, {
'x': 'x2', 'y': 'y2'}, {'x': 'x3', 'y': 'y3'})
assert template == "(%(x)s, %(y)s)"
- assert page_size == 2000
+ assert page_size == 10000
with patch("psycopg2.extras.execute_values", execute_values):
with self.engine.connect() as conn: