MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / Sequence

Class Sequence

lib/sqlalchemy/sql/schema.py:4052–4350  ·  view source on GitHub ↗

Represents a named database sequence. The :class:`.Sequence` object represents the name and configurational parameters of a database sequence. It also represents a construct that can be "executed" by a SQLAlchemy :class:`_engine.Engine` or :class:`_engine.Connection`, renderin

Source from the content-addressed store, hash-verified

4050
4051
4052class Sequence(HasSchemaAttr, IdentityOptions, DefaultGenerator):
4053 """Represents a named database sequence.
4054
4055 The :class:`.Sequence` object represents the name and configurational
4056 parameters of a database sequence. It also represents
4057 a construct that can be "executed" by a SQLAlchemy :class:`_engine.Engine`
4058 or :class:`_engine.Connection`,
4059 rendering the appropriate "next value" function
4060 for the target database and returning a result.
4061
4062 The :class:`.Sequence` is typically associated with a primary key column::
4063
4064 some_table = Table(
4065 "some_table",
4066 metadata,
4067 Column(
4068 "id",
4069 Integer,
4070 Sequence("some_table_seq", start=1),
4071 primary_key=True,
4072 ),
4073 )
4074
4075 When CREATE TABLE is emitted for the above :class:`_schema.Table`, if the
4076 target platform supports sequences, a CREATE SEQUENCE statement will
4077 be emitted as well. For platforms that don't support sequences,
4078 the :class:`.Sequence` construct is ignored.
4079
4080 .. seealso::
4081
4082 :ref:`defaults_sequences`
4083
4084 :class:`.CreateSequence`
4085
4086 :class:`.DropSequence`
4087
4088 """
4089
4090 __visit_name__ = "sequence"
4091
4092 is_sequence = True
4093
4094 column: Optional[Column[Any]]
4095 data_type: Optional[TypeEngine[int]]
4096
4097 metadata: Optional[MetaData]
4098
4099 @util.deprecated_params(
4100 order=(
4101 "2.1",
4102 "This parameter is supported only by Oracle Database, "
4103 "use ``oracle_order`` instead.",
4104 )
4105 )
4106 def __init__(
4107 self,
4108 name: str,
4109 start: Optional[int] = None,

Calls

no outgoing calls