--- /dev/null
+.. change::
+ :tags: schema, bug
+ :tickets: 10207
+ :versions: 2.0.21
+
+ Modified the rendering of the Oracle only :paramref:`.Identity.order`
+ parameter that's part of both :class:`.Sequence` and :class:`.Identity` to
+ only take place for the Oracle backend, and not other backends such as that
+ of PostgreSQL. A future release will rename the
+ :paramref:`.Identity.order`, :paramref:`.Sequence.order` and
+ :paramref:`.Identity.on_null` parameters to Oracle-specific names,
+ deprecating the old names, these parameters only apply to Oracle.
text = text.replace("NO MINVALUE", "NOMINVALUE")
text = text.replace("NO MAXVALUE", "NOMAXVALUE")
text = text.replace("NO CYCLE", "NOCYCLE")
- text = text.replace("NO ORDER", "NOORDER")
- return text
+ if identity_options.order is not None:
+ text += " ORDER" if identity_options.order else " NOORDER"
+ return text.strip()
def visit_computed_column(self, generated):
text = "GENERATED ALWAYS AS (%s)" % self.sql_compiler.process(
"ALWAYS AS IDENTITY (START WITH 1 MAXVALUE 10 CYCLE)",
),
(
- dict(always=False, cache=1000, order=True),
- "BY DEFAULT AS IDENTITY (CACHE 1000 ORDER)",
- ),
- (dict(order=True, cycle=True), "BY DEFAULT AS IDENTITY (ORDER CYCLE)"),
- (
- dict(order=False, cycle=False),
- "BY DEFAULT AS IDENTITY (NO ORDER NO CYCLE)",
+ dict(always=False, cache=1000, cycle=False),
+ "BY DEFAULT AS IDENTITY (CACHE 1000 NO CYCLE)",
),
+ (dict(cycle=True), "BY DEFAULT AS IDENTITY (CYCLE)"),
)
def test_create_ddl(self, identity_args, text):
text = text.replace("NO MINVALUE", "NOMINVALUE")
text = text.replace("NO MAXVALUE", "NOMAXVALUE")
text = text.replace("NO CYCLE", "NOCYCLE")
- text = text.replace("NO ORDER", "NOORDER")
t = Table(
"foo_table",
Column(
"foo",
Integer(),
- Identity(always=False, on_null=True, start=42, order=True),
+ Identity(always=False, on_null=True, start=42, cycle=True),
),
)
text = " ON NULL" if testing.against("oracle") else ""
(
"CREATE TABLE foo_table (foo INTEGER GENERATED BY DEFAULT"
+ text
- + " AS IDENTITY (START WITH 42 ORDER))"
+ + " AS IDENTITY (START WITH 42 CYCLE))"
),
)
assert_raises_message(ArgumentError, text, fn, server_onupdate="42")
def test_to_metadata(self):
- identity1 = Identity("by default", on_null=True, start=123)
+ identity1 = Identity("by default", cycle=True, start=123)
m = MetaData()
t = Table(
"t", m, Column("x", Integer), Column("y", Integer, identity1)
)
self.assert_compile(
- CreateSequence(Sequence("foo_seq", cache=1000, order=True)),
- "CREATE SEQUENCE foo_seq START WITH 1 CACHE 1000 ORDER",
+ CreateSequence(Sequence("foo_seq", cache=1000)),
+ "CREATE SEQUENCE foo_seq START WITH 1 CACHE 1000",
)
+ # remove this when the `order` parameter is removed
+ # issue #10207 - ensure ORDER does not render
+ self.assert_compile(
+ CreateSequence(Sequence("foo_seq", order=True)),
+ "CREATE SEQUENCE foo_seq START WITH 1",
+ )
+ # only renders for Oracle
self.assert_compile(
CreateSequence(Sequence("foo_seq", order=True)),
"CREATE SEQUENCE foo_seq START WITH 1 ORDER",
+ dialect="oracle",
)
self.assert_compile(