.. changelog::
:version: 1.1.12
+ .. change:: cache_order_sequence
+ :tags: feature, oracle, posgresql
+ :versions: 1.2.0b1
+
+ 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.
+
.. changelog::
:version: 1.1.11
:released: Monday, June 19, 2017
a dictionary of the form
{'name' : str, 'start' :int, 'increment': int, 'minvalue': int,
'maxvalue': int, 'nominvalue': bool, 'nomaxvalue': bool,
- 'cycle': bool}
+ 'cycle': bool, 'cache': int, 'order': bool}
Additional column attributes may be present.
"""
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.
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
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
"CREATE SEQUENCE foo_seq START WITH 1 MAXVALUE 10 CYCLE",
)
+ self.assert_compile(
+ CreateSequence(Sequence(
+ 'foo_seq', cache=1000, order=True)),
+ "CREATE SEQUENCE foo_seq CACHE 1000 ORDER",
+ )
+
+ self.assert_compile(
+ CreateSequence(Sequence(
+ 'foo_seq', order=True)),
+ "CREATE SEQUENCE foo_seq ORDER",
+ )
+
self.assert_compile(
DropSequence(Sequence('foo_seq')),
"DROP SEQUENCE foo_seq",