diff options
| author | mike bayer <mike_mp@zzzcomputing.com> | 2021-04-29 12:59:42 +0000 |
|---|---|---|
| committer | Gerrit Code Review <gerrit@ci3.zzzcomputing.com> | 2021-04-29 12:59:42 +0000 |
| commit | 93c8f1df8bb68820624559506f6713a16a9e2250 (patch) | |
| tree | 52904a5a32eb3d5e8748927d83f34d761d89cda3 /lib/sqlalchemy/testing | |
| parent | 11e0466ca2934d630236c45f90db08ad2423c8c6 (diff) | |
| parent | d3c73ad8012e15bf47529b3fcb0bac1298fbdb90 (diff) | |
| download | sqlalchemy-93c8f1df8bb68820624559506f6713a16a9e2250.tar.gz | |
Merge "Propertly ignore ``Identity`` in MySQL and MariaDb."
Diffstat (limited to 'lib/sqlalchemy/testing')
| -rw-r--r-- | lib/sqlalchemy/testing/requirements.py | 7 | ||||
| -rw-r--r-- | lib/sqlalchemy/testing/suite/test_select.py | 25 |
2 files changed, 32 insertions, 0 deletions
diff --git a/lib/sqlalchemy/testing/requirements.py b/lib/sqlalchemy/testing/requirements.py index 8a70cc692..673fa15cd 100644 --- a/lib/sqlalchemy/testing/requirements.py +++ b/lib/sqlalchemy/testing/requirements.py @@ -1417,3 +1417,10 @@ class SuiteRequirements(Requirements): or ties. basically this is "not mssql" """ return exclusions.closed() + + @property + def autoincrement_without_sequence(self): + """If autoincrement=True on a column does not require an explicit + sequence. This should be false only for oracle. + """ + return exclusions.open() diff --git a/lib/sqlalchemy/testing/suite/test_select.py b/lib/sqlalchemy/testing/suite/test_select.py index 7b35dc3fa..8f3412929 100644 --- a/lib/sqlalchemy/testing/suite/test_select.py +++ b/lib/sqlalchemy/testing/suite/test_select.py @@ -1442,6 +1442,31 @@ class IdentityColumnTest(fixtures.TablesTest): assert_raises((DatabaseError, ProgrammingError), fn) +class IdentityAutoincrementTest(fixtures.TablesTest): + __backend__ = True + __requires__ = ("autoincrement_without_sequence",) + + @classmethod + def define_tables(cls, metadata): + Table( + "tbl", + metadata, + Column( + "id", + Integer, + Identity(), + primary_key=True, + autoincrement=True, + ), + Column("desc", String(100)), + ) + + def test_autoincrement_with_identity(self, connection): + res = connection.execute(self.tables.tbl.insert(), {"desc": "row"}) + res = connection.execute(self.tables.tbl.select()).first() + eq_(res, (1, "row")) + + class ExistsTest(fixtures.TablesTest): __backend__ = True |
