]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
* Fix usage of flag execution_mode
authorYuval Dinari <>
Thu, 18 Jul 2019 10:52:59 +0000 (13:52 +0300)
committerYuval Dinari <>
Thu, 18 Jul 2019 10:52:59 +0000 (13:52 +0300)
* Fix test to use new flag
Fixes: #4623
lib/sqlalchemy/dialects/postgresql/psycopg2.py
test/dialect/postgresql/test_dialect.py

index 4c165fd9dc2fb84b49fadc93322f3cf106b63d71..61eb4ba0e4fec793b8d8fec03350ac17fa9b6540 100644 (file)
@@ -607,7 +607,7 @@ class PGCompiler_psycopg2(PGCompiler):
             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"
@@ -840,7 +840,7 @@ class PGDialect_psycopg2(PGDialect):
             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 \
index 13f1c0e54ff76ecfc41d6a467097f8946b44f8a0..9530b3b14f26cb51d9691cac8701415d71620c60 100644 (file)
@@ -172,7 +172,7 @@ class ExecuteBatchInsertsTest(fixtures.TablesTest):
 
     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()
@@ -243,7 +243,7 @@ class ExecuteValuesInsertsTest(fixtures.TablesTest):
     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()
@@ -299,7 +299,7 @@ class ExecuteValuesInsertsTest(fixtures.TablesTest):
             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: