From 94a1c523984e2082bb16d784cf8615061ba9d49a Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Tue, 13 Apr 2021 10:52:00 -0400 Subject: Support DEFAULT VALUES and VALUES(DEFAULT) individually Fixed regression where the introduction of the INSERT syntax "INSERT... VALUES (DEFAULT)" was not supported on some backends that do however support "INSERT..DEFAULT VALUES", including SQLite. The two syntaxes are now each individually supported or non-supported for each dialect, for example MySQL supports "VALUES (DEFAULT)" but not "DEFAULT VALUES". Support for Oracle is still not enabled as there are unresolved issues in using RETURNING at the same time. Fixes: #6254 Change-Id: I47959bc826e3d9d2396ccfa290eb084841b02e77 --- lib/sqlalchemy/testing/suite/test_insert.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'lib/sqlalchemy/testing/suite/test_insert.py') diff --git a/lib/sqlalchemy/testing/suite/test_insert.py b/lib/sqlalchemy/testing/suite/test_insert.py index 35f3315c7..3c033a774 100644 --- a/lib/sqlalchemy/testing/suite/test_insert.py +++ b/lib/sqlalchemy/testing/suite/test_insert.py @@ -167,8 +167,21 @@ class InsertBehaviorTest(fixtures.TablesTest): self.tables.autoinc_pk.c.id != None ) ) + eq_(len(r.all()), 1) - assert len(r.fetchall()) + @requirements.empty_inserts_executemany + def test_empty_insert_multiple(self, connection): + r = connection.execute(self.tables.autoinc_pk.insert(), [{}, {}, {}]) + assert r._soft_closed + assert not r.closed + + r = connection.execute( + self.tables.autoinc_pk.select().where( + self.tables.autoinc_pk.c.id != None + ) + ) + + eq_(len(r.all()), 3) @requirements.insert_from_select def test_insert_from_select_autoinc(self, connection): -- cgit v1.2.1