class Identity(IdentityOptions, FetchedValue, SchemaItem):
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.
See Also
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 |
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 | |
always | A 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_null | Set to True to specify ON NULL in conjunction with a always=False identity column. This option is only supported on some backends, like Oracle. |
start | the starting index of the sequence. |
increment | the increment value of the sequence. |
minvalue | the minimum value of the sequence. |
maxvalue | the maximum value of the sequence. |
nominvalue | no minimum value of the sequence. |
nomaxvalue | no maximum value of the sequence. |
cycle | allows the sequence to wrap around when the maxvalue or minvalue has been reached. |
cache | optional integer value; number of future values in the sequence which are calculated in advance. |
order | optional boolean value; if true, renders the ORDER keyword. |
Undocumented