summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql
diff options
context:
space:
mode:
authorjakeogh <github.com@v6y.net>2015-06-27 18:37:09 +0000
committerjakeogh <github.com@v6y.net>2015-06-27 18:37:09 +0000
commitad7caa69884bddf6f35da2facc516ab08904c71e (patch)
tree75b3af57694a2a773b105f179fb5e45deaf3bd42 /lib/sqlalchemy/sql
parentf31c288b65281511338c518bdf7fbe78c985af58 (diff)
downloadsqlalchemy-ad7caa69884bddf6f35da2facc516ab08904c71e.tar.gz
add MAXVALUE support to Sequence()
Diffstat (limited to 'lib/sqlalchemy/sql')
-rw-r--r--lib/sqlalchemy/sql/compiler.py2
-rw-r--r--lib/sqlalchemy/sql/schema.py13
2 files changed, 12 insertions, 3 deletions
diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py
index b8cf32dff..b3fee60ec 100644
--- a/lib/sqlalchemy/sql/compiler.py
+++ b/lib/sqlalchemy/sql/compiler.py
@@ -2301,6 +2301,8 @@ class DDLCompiler(Compiled):
text += " START WITH %d" % create.element.start
if create.element.minvalue is not None:
text += " MINVALUE %d" % create.element.minvalue
+ if create.element.maxvalue is not None:
+ text += " MAXVALUE %d" % create.element.maxvalue
return text
def visit_drop_sequence(self, drop):
diff --git a/lib/sqlalchemy/sql/schema.py b/lib/sqlalchemy/sql/schema.py
index d49bc2e17..ef84d2680 100644
--- a/lib/sqlalchemy/sql/schema.py
+++ b/lib/sqlalchemy/sql/schema.py
@@ -2041,8 +2041,8 @@ class Sequence(DefaultGenerator):
is_sequence = True
def __init__(self, name, start=None, increment=None, minvalue=None,
- schema=None, optional=False, quote=None, metadata=None,
- quote_schema=None,
+ maxvalue=None, schema=None, optional=False, quote=None,
+ metadata=None, quote_schema=None,
for_update=False):
"""Construct a :class:`.Sequence` object.
@@ -2061,7 +2061,14 @@ class Sequence(DefaultGenerator):
value is used when the CREATE SEQUENCE command is emitted to
the database as the value of the "MINVALUE" clause. If ``None``,
the clause is omitted, which on most platforms indicates a
- minvalue of 1.
+ minvalue of 1 and -2^63-1 for ascending and descending sequences,
+ respectively.
+ :param maxvalue: the maximum value of the sequence. This
+ value is used when the CREATE SEQUENCE command is emitted to
+ the database as the value of the "MAXVALUE" clause. If ``None``,
+ the clause is omitted, which on most platforms indicates a
+ maxvalue of 2^63-1 and -1 for ascending and descending sequences,
+ respectively.
:param schema: Optional schema name for the sequence, if located
in a schema other than the default.
:param optional: boolean value, when ``True``, indicates that this