summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql/schema.py
diff options
context:
space:
mode:
authorDavid Moore <davidm@j5int.com>2017-07-05 15:06:49 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2017-07-05 16:21:44 -0400
commitfaa6609dac2ce6e55e0f690df3ba88c13133ec5c (patch)
treef89f6370f67acf35b8909bfc091bfa68c35e7e21 /lib/sqlalchemy/sql/schema.py
parentb7a51f3a9c90c577e315bc0c3881b4c7623450e2 (diff)
downloadsqlalchemy-faa6609dac2ce6e55e0f690df3ba88c13133ec5c.tar.gz
Add support for CACHE and ORDER to sequences
Added new keywords :paramref:`.Sequence.cache` and :paramref:`.Sequence.order` to :class:`.Sequence`, to allow rendering of the CACHE parameter understood by Oracle and PostgreSQL, and the ORDER parameter understood by Oracle. Pull request courtesy David Moore. Change-Id: I082c3f8ef56ef89dbaad5da9d5695be5313b0614 Pull-request: https://bitbucket.org/zzzeek/sqlalchemy/pull-requests/96
Diffstat (limited to 'lib/sqlalchemy/sql/schema.py')
-rw-r--r--lib/sqlalchemy/sql/schema.py19
1 files changed, 17 insertions, 2 deletions
diff --git a/lib/sqlalchemy/sql/schema.py b/lib/sqlalchemy/sql/schema.py
index 3ba36e714..9b73eca63 100644
--- a/lib/sqlalchemy/sql/schema.py
+++ b/lib/sqlalchemy/sql/schema.py
@@ -2148,8 +2148,8 @@ class Sequence(DefaultGenerator):
def __init__(self, name, start=None, increment=None, minvalue=None,
maxvalue=None, nominvalue=None, nomaxvalue=None, cycle=None,
- schema=None, optional=False, quote=None, metadata=None,
- quote_schema=None,
+ schema=None, cache=None, order=None, optional=False,
+ quote=None, metadata=None, quote_schema=None,
for_update=False):
"""Construct a :class:`.Sequence` object.
@@ -2216,6 +2216,19 @@ class Sequence(DefaultGenerator):
schema name when a :class:`.MetaData` is also present are the same
as that of :paramref:`.Table.schema`.
+ :param cache: optional integer value; number of future values in the
+ sequence which are calculated in advance. Renders the CACHE keyword
+ understood by Oracle and PostgreSQL.
+
+ .. versionadded:: 1.1.12
+
+ :param order: optional boolean value; if true, renders the
+ ORDER keyword, understood by Oracle, indicating the sequence is
+ definitively ordered. May be necessary to provide deterministic
+ ordering using Oracle RAC.
+
+ .. versionadded:: 1.1.12
+
:param optional: boolean value, when ``True``, indicates that this
:class:`.Sequence` object only needs to be explicitly generated
on backends that don't provide another way to generate primary
@@ -2271,6 +2284,8 @@ class Sequence(DefaultGenerator):
self.nominvalue = nominvalue
self.nomaxvalue = nomaxvalue
self.cycle = cycle
+ self.cache = cache
+ self.order = order
self.optional = optional
if schema is BLANK_SCHEMA:
self.schema = schema = None