]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
don't INSERT a blank row if no rows passed. (breaks all the tests for SQLite on the...
authorMike Bayer <mike_mp@zzzcomputing.com>
Sun, 11 Jan 2009 23:55:35 +0000 (23:55 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sun, 11 Jan 2009 23:55:35 +0000 (23:55 +0000)
test/orm/_fixtures.py

index 4d4e744adb2a8413e6a47e4e212c051c567d967d..f036b92b2a5b825a1f0fb243f588aacc765210d8 100644 (file)
@@ -10,9 +10,10 @@ fixture_metadata = MetaData()
 def fixture_table(table, columns, *rows):
     def load_fixture(bind=None):
         bind = bind or table.bind
-        bind.execute(
-            table.insert(),
-            [dict(zip(columns, column_values)) for column_values in rows])
+        if rows:
+            bind.execute(
+                table.insert(),
+                [dict(zip(columns, column_values)) for column_values in rows])
     table.info[('fixture', 'loader')] = load_fixture
     table.info[('fixture', 'columns')] = columns
     table.info[('fixture', 'rows')] = rows