Defines an identity column, i.e. "GENERATED { ALWAYS | BY DEFAULT } AS IDENTITY" syntax. The :class:`.Identity` construct is an inline construct added to the argument list of a :class:`_schema.Column` object:: from sqlalchemy import Identity Table( "foo",
| 6521 | |
| 6522 | |
| 6523 | class Identity(IdentityOptions, FetchedValue, SchemaItem): |
| 6524 | """Defines an identity column, i.e. "GENERATED { ALWAYS | BY DEFAULT } |
| 6525 | AS IDENTITY" syntax. |
| 6526 | |
| 6527 | The :class:`.Identity` construct is an inline construct added to the |
| 6528 | argument list of a :class:`_schema.Column` object:: |
| 6529 | |
| 6530 | from sqlalchemy import Identity |
| 6531 | |
| 6532 | Table( |
| 6533 | "foo", |
| 6534 | metadata_obj, |
| 6535 | Column("id", Integer, Identity()), |
| 6536 | Column("description", Text), |
| 6537 | ) |
| 6538 | |
| 6539 | See the linked documentation below for complete details. |
| 6540 | |
| 6541 | .. versionadded:: 1.4 |
| 6542 | |
| 6543 | .. seealso:: |
| 6544 | |
| 6545 | :ref:`identity_ddl` |
| 6546 | |
| 6547 | """ |
| 6548 | |
| 6549 | __visit_name__ = "identity_column" |
| 6550 | |
| 6551 | is_identity = True |
| 6552 | |
| 6553 | @util.deprecated_params( |
| 6554 | order=( |
| 6555 | "2.1", |
| 6556 | "This parameter is supported only by Oracle Database, " |
| 6557 | "use ``oracle_order`` instead.", |
| 6558 | ), |
| 6559 | on_null=( |
| 6560 | "2.1", |
| 6561 | "This parameter is supported only by Oracle Database, " |
| 6562 | "use ``oracle_on_null`` instead.", |
| 6563 | ), |
| 6564 | ) |
| 6565 | def __init__( |
| 6566 | self, |
| 6567 | always: Optional[bool] = False, |
| 6568 | on_null: Optional[bool] = None, |
| 6569 | start: Optional[int] = None, |
| 6570 | increment: Optional[int] = None, |
| 6571 | minvalue: Optional[int] = None, |
| 6572 | maxvalue: Optional[int] = None, |
| 6573 | nominvalue: Optional[bool] = None, |
| 6574 | nomaxvalue: Optional[bool] = None, |
| 6575 | cycle: Optional[bool] = None, |
| 6576 | cache: Optional[int] = None, |
| 6577 | order: Optional[bool] = None, |
| 6578 | **dialect_kw: Any, |
| 6579 | ) -> None: |
| 6580 | """Construct a GENERATED { ALWAYS | BY DEFAULT } AS IDENTITY DDL |
no outgoing calls