summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy
diff options
context:
space:
mode:
authorFederico Caselli <cfederico87@gmail.com>2020-12-01 23:47:13 +0100
committerFederico Caselli <cfederico87@gmail.com>2020-12-01 23:49:17 +0100
commit302e18eb75f29e651e67b18033487e40758d7c83 (patch)
tree1e3fb8a26f0956f0384f80033e7a9f3d38370e88 /lib/sqlalchemy
parent14c08d18885e16611b884bd76ba2811375de1731 (diff)
downloadsqlalchemy-302e18eb75f29e651e67b18033487e40758d7c83.tar.gz
Properly render ``cycle=False`` and ``order=False``
These get rendered as ``NO CYCLE`` and ``NO ORDER`` in :class:`_sql.Sequence` and :class:`_sql.Identity` objects. Fixes: #5738 Change-Id: Ia9ccb5481a104cb32d3b517e99efd5e730c84946
Diffstat (limited to 'lib/sqlalchemy')
-rw-r--r--lib/sqlalchemy/dialects/oracle/base.py8
-rw-r--r--lib/sqlalchemy/sql/compiler.py6
2 files changed, 8 insertions, 6 deletions
diff --git a/lib/sqlalchemy/dialects/oracle/base.py b/lib/sqlalchemy/dialects/oracle/base.py
index c0f7aa5ce..223c1db98 100644
--- a/lib/sqlalchemy/dialects/oracle/base.py
+++ b/lib/sqlalchemy/dialects/oracle/base.py
@@ -1329,9 +1329,11 @@ class OracleDDLCompiler(compiler.DDLCompiler):
text = super(OracleDDLCompiler, self).get_identity_options(
identity_options
)
- return text.replace("NO MINVALUE", "NOMINVALUE").replace(
- "NO MAXVALUE", "NOMAXVALUE"
- )
+ 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
def visit_computed_column(self, generated):
text = "GENERATED ALWAYS AS (%s)" % self.sql_compiler.process(
diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py
index 9b90bf868..d53fe01c2 100644
--- a/lib/sqlalchemy/sql/compiler.py
+++ b/lib/sqlalchemy/sql/compiler.py
@@ -4050,10 +4050,10 @@ class DDLCompiler(Compiled):
text.append("NO MAXVALUE")
if identity_options.cache is not None:
text.append("CACHE %d" % identity_options.cache)
- if identity_options.order is True:
- text.append("ORDER")
+ if identity_options.order is not None:
+ text.append("ORDER" if identity_options.order else "NO ORDER")
if identity_options.cycle is not None:
- text.append("CYCLE")
+ text.append("CYCLE" if identity_options.cycle else "NO CYCLE")
return " ".join(text)
def visit_create_sequence(self, create, prefix=None, **kw):