commands on the current connection. This was already the case with
``--sql`` mode, so is now the case with "online" mode.
# work around http://www.sqlalchemy.org/trac/ticket/2461
if not hasattr(table, '_autoincrement_column'):
table._autoincrement_column = None
- self._exec(table.insert(inline=True), multiparams=rows)
+ if rows:
+ self._exec(table.insert(inline=True), multiparams=rows)
def compare_type(self, inspector_column, metadata_column):
.. changelog::
:version: 0.6.3
+ .. change::
+ :tags: bug
+ :tickets: 168
+
+ Calling :func:`.bulk_insert` with an empty list will not emit any
+ commands on the current connection. This was already the case with
+ ``--sql`` mode, so is now the case with "online" mode.
+
.. change::
:tags: bug
:pullreq: bitbucket:17
'INSERT INTO ins_table (id, v1, v2) VALUES (%(id)s, %(v1)s, %(v2)s)'
)
+def test_bulk_insert_no_rows():
+ context, t1 = _table_fixture('default', False)
+
+ op.bulk_insert(t1, [])
+ context.assert_()
+
def test_bulk_insert_pg():
context = _test_bulk_insert('postgresql', False)
context.assert_(