summaryrefslogtreecommitdiff
path: root/test/sql/test_defaults.py
diff options
context:
space:
mode:
authorFederico Caselli <cfederico87@gmail.com>2022-09-24 15:50:26 +0200
committerMike Bayer <mike_mp@zzzcomputing.com>2022-10-17 15:36:25 -0400
commit974b1bd0fc40e11fc2886b5a9fc333feeeebf546 (patch)
tree421f0545c13a203f40435c4646a0de664e0e9756 /test/sql/test_defaults.py
parent665c94cc2f0340735515c4f4477e11b556d2bcd8 (diff)
downloadsqlalchemy-974b1bd0fc40e11fc2886b5a9fc333feeeebf546.tar.gz
Revert automatic set of sequence start to 1
The :class:`.Sequence` construct restores itself to the DDL behavior it had prior to the 1.4 series, where creating a :class:`.Sequence` with no additional arguments will emit a simple ``CREATE SEQUENCE`` instruction **without** any additional parameters for "start value". For most backends, this is how things worked previously in any case; **however**, for MS SQL Server, the default value on this database is ``-2**63``; to prevent this generally impractical default from taking effect on SQL Server, the :paramref:`.Sequence.start` parameter should be provided. As usage of :class:`.Sequence` is unusual for SQL Server which for many years has standardized on ``IDENTITY``, it is hoped that this change has minimal impact. Fixes: #7211 Change-Id: I1207ea10c8cb1528a1519a0fb3581d9621c27b31
Diffstat (limited to 'test/sql/test_defaults.py')
-rw-r--r--test/sql/test_defaults.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/test/sql/test_defaults.py b/test/sql/test_defaults.py
index 08911a6c5..1249529f3 100644
--- a/test/sql/test_defaults.py
+++ b/test/sql/test_defaults.py
@@ -19,11 +19,13 @@ from sqlalchemy.sql import select
from sqlalchemy.sql import text
from sqlalchemy.testing import assert_raises_message
from sqlalchemy.testing import AssertsCompiledSQL
+from sqlalchemy.testing import config
from sqlalchemy.testing import eq_
from sqlalchemy.testing import expect_warnings
from sqlalchemy.testing import fixtures
from sqlalchemy.testing import mock
from sqlalchemy.testing.assertions import expect_deprecated
+from sqlalchemy.testing.provision import normalize_sequence
from sqlalchemy.testing.schema import Column
from sqlalchemy.testing.schema import Table
from sqlalchemy.types import TypeDecorator
@@ -1030,7 +1032,9 @@ class PKIncrementTest(fixtures.TablesTest):
Column(
"id",
Integer,
- Sequence("ai_id_seq", optional=True),
+ normalize_sequence(
+ config, Sequence("ai_id_seq", optional=True)
+ ),
primary_key=True,
),
Column("int1", Integer),
@@ -1171,7 +1175,7 @@ class AutoIncrementTest(fixtures.TestBase):
# and autoincrement=False. Using a ForeignKey
# would have the same effect
- some_seq = Sequence("some_seq")
+ some_seq = normalize_sequence(config, Sequence("some_seq"))
dataset_no_autoinc = Table(
"x",
@@ -1313,7 +1317,7 @@ class SpecialTypePKTest(fixtures.TestBase):
self._run_test(default=literal_column("1", type_=self.MyInteger))
def test_sequence(self):
- self._run_test(Sequence("foo_seq"))
+ self._run_test(normalize_sequence(config, Sequence("foo_seq")))
def test_text_clause_default_no_type(self):
self._run_test(default=text("1"))