class documentation

class Identity(IdentityOptions, FetchedValue, SchemaItem):

View In Hierarchy

Defines an identity column, i.e. "GENERATED { ALWAYS | BY DEFAULT } AS IDENTITY" syntax.

The .Identity construct is an inline construct added to the argument list of a _schema.Column object:

from sqlalchemy import Identity

Table('foo', metadata_obj,
    Column('id', Integer, Identity())
    Column('description', Text),
)

See the linked documentation below for complete details.

New in version 1.4.
Method __init__ Construct a GENERATED { ALWAYS | BY DEFAULT } AS IDENTITY DDL construct to accompany a _schema.Column.
Method ​_as​_for​_update Undocumented
Method ​_copy Undocumented
Method ​_set​_parent Associate with this SchemaEvent's parent object.
Method copy Undocumented
Class Variable __visit​_name__ Undocumented
Instance Variable always Undocumented
Instance Variable column Undocumented
Instance Variable on​_null Undocumented

Inherited from IdentityOptions:

Instance Variable cache Undocumented
Instance Variable cycle Undocumented
Instance Variable increment Undocumented
Instance Variable maxvalue Undocumented
Instance Variable minvalue Undocumented
Instance Variable nomaxvalue Undocumented
Instance Variable nominvalue Undocumented
Instance Variable order Undocumented
Instance Variable start Undocumented

Inherited from FetchedValue:

Method __repr__ Undocumented
Method ​_clone Undocumented
Class Variable has​_argument Undocumented
Class Variable is​_clause​_element Undocumented
Class Variable is​_server​_default Undocumented
Class Variable reflected Undocumented
Instance Variable for​_update Undocumented

Inherited from SchemaEventTarget (via FetchedValue):

Method ​_set​_parent​_with​_dispatch Undocumented

Inherited from SchemaItem:

Method __repr__ Undocumented
Method ​_init​_items Initialize the list of child items for this SchemaItem.
Method ​_schema​_item​_copy Undocumented
Class Variable ​_use​_schema​_map Undocumented
Class Variable create​_drop​_stringify​_dialect Undocumented
Property info Info dictionary associated with the object, allowing user-defined data to be associated with this .SchemaItem.

Inherited from SchemaEventTarget (via SchemaItem):

Method ​_set​_parent​_with​_dispatch Undocumented

Inherited from Traversible (via SchemaItem):

Method get​_children Return immediate child .visitors.Traversible elements of this .visitors.Traversible.
Method __class​_getitem__ Undocumented
def __init__(self, always=False, on_null=None, start=None, increment=None, minvalue=None, maxvalue=None, nominvalue=None, nomaxvalue=None, cycle=None, cache=None, order=None):

Construct a GENERATED { ALWAYS | BY DEFAULT } AS IDENTITY DDL construct to accompany a _schema.Column.

See the .Sequence documentation for a complete description of most parameters.

Note

MSSQL supports this construct as the preferred alternative to generate an IDENTITY on a column, but it uses non standard syntax that only support :paramref:`_schema.Identity.start` and :paramref:`_schema.Identity.increment`. All other parameters are ignored.

Parameters
alwaysA boolean, that indicates the type of identity column. If False is specified, the default, then the user-specified value takes precedence. If True is specified, a user-specified value is not accepted ( on some backends, like PostgreSQL, OVERRIDING SYSTEM VALUE, or similar, may be specified in an INSERT to override the sequence value). Some backends also have a default value for this parameter, None can be used to omit rendering this part in the DDL. It will be treated as False if a backend does not have a default value.
on​_nullSet to True to specify ON NULL in conjunction with a always=False identity column. This option is only supported on some backends, like Oracle.
startthe starting index of the sequence.
incrementthe increment value of the sequence.
minvaluethe minimum value of the sequence.
maxvaluethe maximum value of the sequence.
nominvalueno minimum value of the sequence.
nomaxvalueno maximum value of the sequence.
cycleallows the sequence to wrap around when the maxvalue or minvalue has been reached.
cacheoptional integer value; number of future values in the sequence which are calculated in advance.
orderoptional boolean value; if true, renders the ORDER keyword.
def _as_for_update(self, for_update):
def _copy(self, **kw):

Undocumented

def _set_parent(self, parent, **kw):
Associate with this SchemaEvent's parent object.
@util.deprecated('1.4', 'The :meth:`_schema.Identity.copy` method is deprecated and will be removed in a future release.')
def copy(self, **kw):

Undocumented

__visit_name__: str =
always =

Undocumented

column =
on_null =

Undocumented