Sh3ll
OdayForums


Server : LiteSpeed
System : Linux premium84.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
User : claqxcrl ( 523)
PHP Version : 8.1.32
Disable Function : NONE
Directory :  /opt/hc_python/lib64/python3.12/site-packages/sqlalchemy/sql/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //opt/hc_python/lib64/python3.12/site-packages/sqlalchemy/sql/__pycache__/schema.cpython-312.pyc
�

���g���	�0	�UdZddlmZddlmZddlZddlmZddlZddl	Z	ddl	m
Z
ddl	mZddl	mZdd	l	m
Z
dd
l	mZddl	mZddl	mZdd
l	mZddl	mZddl	mZddl	mZddl	mZddl	mZddl	mZddl	mZddl	mZddl	mZddl	mZddlmZddlmZddlm Z ddlm!Z!ddlm"Z"ddl#m$Z$ddl#m%Z%dd l#m&Z&dd!l#m'Z'dd"l#m(Z(dd#l#m)Z)dd$l#m*Z*dd%l#m+Z+dd&l#m,Z,dd'lm-Z-dd(l.m/Z/dd)l.m0Z0dd*l.m1Z1dd+l.m2Z2dd,l.m3Z3dd-l4m5Z5dd.l!m6Z6dd/l"m7Z7d0d1lm8Z8d0d2lm9Z9d0d3lm:Z:d0d4lm;Z;d0d5l;m<Z<d0d6l=m>Z>d0d7l=m?Z?d0d8l=m@Z@d0d9l=mAZAd0d:l=mBZBd0d;l=mCZCe	j4r~dd<lDmEZEdd=lDmFZFdd>lDmGZGdd?lDmHZHdd@lDmIZIddAl#mJZJddBl#mKZKddClLmMZMddDl.mNZNddEl.mOZOddFlPmQZQddGl!mRZRddHl"mSZSd0dIlTmUZUd0dJlTmVZVd0dKlWmXZXd0dLlWmYZYd0dMlWmZZZd0dNl[m\Z\d0dOl]m^Z^d0dPl_m`Z`edQdR�S�ZaedTdU�S�ZbedVdW�S�ZcedXZdeeeee&fZfedYeee3e1e
fZgegZhGdZ�d[e�Zieij�Zjd\ekd]<eij�Zld^ekd_<eij�Zmd`ekda<d�db�Zn								d�dc�Zoe:j�Gdd�dUe,e"j���ZrGde�df�ZsGdg�dher�ZtGdi�dWe*ete5e:j�dW�ZvGdj�dke*ere0ea�Zw		d�ddldm�									d�dn�ZxGdo�dpe*er�Zyer				d�dq�Zz				d�dr�Z{				d�ds�Z|n6ej�dt�Zzej�du�Z{ej�dv�Z|Gdw�dxe+er�Z~Gdy�dze~e�ZGd{�d|e�Z�Gd}�d~e�Z�edZ�Gd��d�e�Z�Gd��d�e@�Z�Gd��d�e�Z�Gd��d��Z�Gd��d�ete�e~�Ze:j�Gd��dYe,��Z�Gd��d�e��Z�Gd��d�e*eser�Z�Gd��d��Z�Gd��d�e�e��Z�Gd��d�e��Z�Gd��d�e��Z�Gd��d�e��Z�Gd��d�e��Z�Gd��d�e*e�eser�Z�ee�evgeefZ�eeee�fZ�Gd��d�eBd����Z�ee�ee
e�ffZ�e;�j*d�d�i�Z�d�ekd�<Gd��d�et�Z�Gd��d�e�er�Z�Gd��d�e�e�er�Z�y)�a/The schema module provides the building blocks for database metadata.

Each element within this module describes a database entity which can be
created and dropped, or is otherwise part of such an entity.  Examples include
tables, columns, sequences, and indexes.

All entities are subclasses of :class:`~sqlalchemy.schema.SchemaItem`, and as
defined in this module they are intended to be agnostic of any vendor-specific
constructs.

A collection of entities are grouped into a unit called
:class:`~sqlalchemy.schema.MetaData`. MetaData serves as a logical grouping of
schema elements, and can also be associated with an actual database connection
such that operations involving the contained elements can contact the database
as needed.

Two of the elements here also build upon their "syntactic" counterparts, which
are defined in :class:`~sqlalchemy.sql.expression.`, specifically
:class:`~sqlalchemy.schema.Table` and :class:`~sqlalchemy.schema.Column`.
Since these objects are part of the SQL expression language, they are usable
as components in SQL expressions.

�)�annotations)�ABCN)�Enum)�Any)�Callable)�cast)�
Collection)�Dict)�Iterable)�Iterator)�List)�Mapping)�NoReturn)�Optional)�overload)�Sequence)�Set)�Tuple)�
TYPE_CHECKING)�TypeVar)�Union�)�	coercions)�ddl)�roles)�type_api)�visitors)�_DefaultDescriptionTuple)�_NoArg)�	_NoneName)�_SentinelColumnCharacterization)� _SentinelDefaultCharacterization)�DedupeColumnCollection)�
DialectKWArgs)�
Executable)�SchemaEventTarget)�_document_text_coercion)�
ClauseElement)�ColumnClause)�
ColumnElement)�quoted_name)�
TextClause)�TableClause)�to_instance)�ExternallyTraversible�)�event)�exc)�
inspection)�util)�HasMemoized)�Final)�Literal)�Protocol)�Self)�	TypedDict)�	TypeGuard)�_AutoIncrementType)�_DDLColumnArgument)�	_InfoType)�_TextCoercedExpressionArgument)�_TypeEngineArgument)�	ColumnSet)�ReadOnlyColumnCollection)�DDLCompiler)�
BindParameter)�KeyedColumnElement)�Function)�
TypeEngine)�anon_map)�
Connection)�Engine)�_CoreMultiExecuteParams)�CoreExecuteOptionsParameter)�ExecutionContext)�MockConnection)�_ReflectionInfo)�
FromClause�_Tr)�bound�_SI�
SchemaItem�_TAB�Table)rJrIrN�FetchedValuec��eZdZdZ	dZ	dZy)�SchemaConstrr0�N)�__name__�
__module__�__qualname__�
RETAIN_SCHEMA�BLANK_SCHEMA�NULL_UNSPECIFIED���F/opt/hc_python/lib64/python3.12/site-packages/sqlalchemy/sql/schema.pyrYrY�s%���M���L����rbrYz)Final[Literal[SchemaConst.RETAIN_SCHEMA]]r^z(Final[Literal[SchemaConst.BLANK_SCHEMA]]r_z,Final[Literal[SchemaConst.NULL_UNSPECIFIED]]r`c��|�|S|dz|zS)N�.ra)�name�schemas  rc�_get_table_keyrh�s��
�~�����|�d�"�"rbc����|�|�|S|�|�						d��fd�}ttttj|i|��S)Nc���t|t�r?|j�ur1|j�jvr�j|jSy�N)�
isinstance�Column�table�key�c)�element�kw�fixed_source_table�fixed_target_tables  ��rc�replacez!_copy_expression.<locals>.replace�sG���
�w��'��
�
�!3�3����1�3�3�3�%�'�'����4�4�rb)rqr/rrr�returnzOptional[ExternallyTraversible])rr*rr�replacement_traverse)�
expression�source_table�target_tablerursrts    @@rc�_copy_expressionr{�sh���
��|�3���%��%��
�&�
�.1�
�	(�
���c���%�%�j�"�g�>��rbc�Z�eZdZdZdZdZd
d�Zdd�Zejdd��Z
d
d�ZdZy	)rTz3Base class for items that define a database schema.�schema_item�defaultc��|D]}|��	|j}||fi|���y#t$r}tjd|���|�d}~wwxYw)z7Initialize the list of child items for this SchemaItem.NzH'SchemaItem' object, such as a 'Column' or a 'Constraint' expected, got )�_set_parent_with_dispatch�AttributeErrorr2�
ArgumentError)�self�argsrr�item�spwd�errs      rc�_init_itemszSchemaItem._init_items�sj���D���%��9�9�D���$��$���&���+�+�6�6:�X�?������s�"�	A	�A�A	c�2�tj|dg��S)N�info)�
omit_kwarg�r4�generic_repr�r�s rc�__repr__zSchemaItem.__repr__�s��� � ��6�(�;�;rbc��iS)aZInfo dictionary associated with the object, allowing user-defined
        data to be associated with this :class:`.SchemaItem`.

        The dictionary is automatically generated when first accessed.
        It can also be specified in the constructor of some objects,
        such as :class:`_schema.Table` and :class:`_schema.Column`.

        rar�s rcr�zSchemaItem.info�s	���	rbc��d|jvr|jj�|_|jj	|j�|S)Nr�)�__dict__r��copy�dispatch�_update)r�r}s  rc�_schema_item_copyzSchemaItem._schema_item_copy�s?���T�]�]�"�#�y�y�~�~�/�K�����$�$�T�]�]�3��rbTN)r�rTrrrrv�None�rv�str)rvr>)r}rSrvrS)
r[r\r]�__doc__�__visit_name__�create_drop_stringify_dialectr�r�r4�memoized_propertyr�r��_use_schema_maprarbrcrTrT�s@��=�"�N�$-�!�%�<�
���	��	���Orbc�>�eZdZUdZdZded<			d							dd�Zy)�HasConditionalDDLz�define a class that includes the :meth:`.HasConditionalDDL.ddl_if`
    method, allowing for conditional rendering of DDL.

    Currently applies to constraints and indexes.

    .. versionadded:: 2.0


    NzOptional[ddl.DDLIf]�_ddl_ifc�>�tj|||�|_|S)a�apply a conditional DDL rule to this schema item.

        These rules work in a similar manner to the
        :meth:`.ExecutableDDLElement.execute_if` callable, with the added
        feature that the criteria may be checked within the DDL compilation
        phase for a construct such as :class:`.CreateTable`.
        :meth:`.HasConditionalDDL.ddl_if` currently applies towards the
        :class:`.Index` construct as well as all :class:`.Constraint`
        constructs.

        :param dialect: string name of a dialect, or a tuple of string names
         to indicate multiple dialect types.

        :param callable\_: a callable that is constructed using the same form
         as that described in
         :paramref:`.ExecutableDDLElement.execute_if.callable_`.

        :param state: any arbitrary object that will be passed to the
         callable, if present.

        .. versionadded:: 2.0

        .. seealso::

            :ref:`schema_ddl_ddl_if` - background and usage examples


        )r�DDLIfr�)r��dialect�	callable_�states    rc�ddl_ifzHasConditionalDDL.ddl_ifs��D�y�y��)�U�;����rb)NNN)r��
Optional[str]r�zOptional[ddl.DDLIfCallable]r��
Optional[Any]rvr9)r[r\r]r�r��__annotations__r�rarbrcr�r�sJ���$(�G�
 �'�"&�15�#�	#��#�/�#��	#�

�#rbr�c��eZdZUdZded<y)�
HasSchemaAttrz1schema item that includes a top-level schema namer�rgN)r[r\r]r�r�rarbrcr�r�7s��;��rbr�c���eZdZUdZdZer&ejd1d��Zejd2d��Z	de
d<de
d<d	e
d
<	de
d<	er;ejd3d
��Zej		d3d��Zejd3d��Z
						d4d�Zej
sej d��d5d��Zed5d��Zddddddddddddddddd�																																									d6�fd�Z				d7															d8d�Zed9d��Zed:d��Zd;d�Zd<d�Zd=d�Zd=d �Zejd>d!��Zej<		d?d"��Zed>d#��Z ed@d$��Z!d@d%�Z"d@d&�Z#dAd'�Z$	dB					dCd(�Z%dDd)�Z&dEd*�Z'dBdFd+�Z(dBdFd,�Z)ejTd-d.�e+ddf									dGd/��Z,e+ddf									dGd0�Z-�xZ.S)HrVaRepresent a table in a database.

    e.g.::

        mytable = Table(
            "mytable",
            metadata,
            Column("mytable_id", Integer, primary_key=True),
            Column("value", String(50)),
        )

    The :class:`_schema.Table`
    object constructs a unique instance of itself based
    on its name and optional schema name within the given
    :class:`_schema.MetaData` object. Calling the :class:`_schema.Table`
    constructor with the same name and same :class:`_schema.MetaData` argument
    a second time will return the *same* :class:`_schema.Table`
    object - in this way
    the :class:`_schema.Table` constructor acts as a registry function.

    .. seealso::

        :ref:`metadata_describing` - Introduction to database metadata

    rnc��yrkrar�s rc�primary_keyzTable.primary_key^s��7:rbc��yrkrar�s rc�foreign_keyszTable.foreign_keysas��36rb�#DedupeColumnCollection[Column[Any]]�_columns�Optional[Column[Any]]�_sentinel_column�Set[Constraint]�constraintsz
Set[Index]�indexesc��yrkrar�s rc�columnsz
Table.columns�s��ILrbc��yrkrar�s rc�exported_columnszTable.exported_columns�s��:=rbc��yrkrar�s rcrpzTable.c�s��CFrbc�@�|jr|f|jzS|fSrk)�_annotations�_annotations_cache_key)r�rH�
bindparamss   rc�_gen_cache_keyzTable._gen_cache_key�s'������7�T�8�8�8�8��7�Nrb)�1.4z8Deprecated alias of :paramref:`_schema.Table.must_exist`)�	mustexistc�&�|j|i|��Srk)�_new)�clsr�rrs   rc�__new__z
Table.__new__�s���3�8�8�T�(�R�(�(rbc�.�|s|stj|�S	|d|d|dd}}}|j	dd�}|�
|j
}n
|turd}|j	dd�}|j	dd�}|r|rd	}tj|��|jd
|jdd��}	t||�}
|
|jvrM|s&|s$t|�rtjd|
�d
���|j|
}|r|j|i|��|S|	rtjd|
�d���tj|�}|jj!||�|j#|||�	|j$||g|��ddi|��|jj'||�|S#t$rtd��wxYw#t($r?t+j,�5|j/||�ddd�Yy#1swYYyxYwwxYw)Nrrr0zJTable() takes at least two positional-only arguments 'name' and 'metadata'rg�
keep_existingF�extend_existingz9keep_existing and extend_existing are mutually exclusive.�
must_existr��Table 'z�' is already defined for this MetaData instance.  Specify 'extend_existing=True' to redefine options and columns on an existing Table object.z
' not defined�_no_init)�objectr��
IndexError�	TypeError�getrgr_r2r��poprh�tables�bool�InvalidRequestError�_init_existingr��before_parent_attach�
_add_table�__init__�after_parent_attach�	Exceptionr4�safe_reraise�
_remove_table)r�r�rrrf�metadatargr�r��msgr�rorns            rcr�z
Table._new�s���B��>�>�#�&�&�	�#'��7�D��G�T�!�"�X�D�(�D�����$�'���>��_�_�F�
�|�
#��F������6�
��&�&�!2�E�:���_�M�C��#�#�C�(�(��V�V�L�"�&�&��e�*D�E�
��T�6�*���(�/�/�!� ��T�$�Z��-�-��c�U�#-�-����O�O�C�(�E��$��$�$�d�1�b�1��L���-�-���u�M�.J�K�K��N�N�3�'�E��N�N�/�/��x�@�����f�e�4�
9�����t�X�K��K�u�K��K����2�2�5�(�C����U�	��2��
�	��V�
9��&�&�(��*�*�4��8�)�(�(��
9�s5�F4�=6G�4G	�H�)H�<H�H	�H�HNTF)rg�quote�quote_schema�
autoload_with�autoload_replacer�r��resolve_fks�include_columns�implicit_returning�commentr��	listeners�prefixes�
_extend_onr�c�P��|ryt�|�t||��||_|�|j|_n5|t
urd|_n%|}t
|t�sJ�t||�|_d|_t�|_
t�|_td��j|�t�|_t�|_|j�!|j�d|j ��|_n|j |_||_|j'dd�}|
|_|�||_|�!|D]\}}t-j.|||��|r|ng|_|j2di|��|�|j5||||||
��|j6||	xs|xs|id��y)	aq6Constructor for :class:`_schema.Table`.


        :param name: The name of this table as represented in the database.

            The table name, along with the value of the ``schema`` parameter,
            forms a key which uniquely identifies this :class:`_schema.Table`
            within
            the owning :class:`_schema.MetaData` collection.
            Additional calls to :class:`_schema.Table` with the same name,
            metadata,
            and schema name will return the same :class:`_schema.Table` object.

            Names which contain no upper case characters
            will be treated as case insensitive names, and will not be quoted
            unless they are a reserved word or contain special characters.
            A name with any number of upper case characters is considered
            to be case sensitive, and will be sent as quoted.

            To enable unconditional quoting for the table name, specify the flag
            ``quote=True`` to the constructor, or use the :class:`.quoted_name`
            construct to specify the name.

        :param metadata: a :class:`_schema.MetaData`
            object which will contain this
            table.  The metadata is used as a point of association of this table
            with other tables which are referenced via foreign key.  It also
            may be used to associate this table with a particular
            :class:`.Connection` or :class:`.Engine`.

        :param \*args: Additional positional arguments are used primarily
            to add the list of :class:`_schema.Column`
            objects contained within this
            table. Similar to the style of a CREATE TABLE statement, other
            :class:`.SchemaItem` constructs may be added here, including
            :class:`.PrimaryKeyConstraint`, and
            :class:`_schema.ForeignKeyConstraint`.

        :param autoload_replace: Defaults to ``True``; when using
            :paramref:`_schema.Table.autoload_with`
            in conjunction with :paramref:`_schema.Table.extend_existing`,
            indicates
            that :class:`_schema.Column` objects present in the already-existing
            :class:`_schema.Table`
            object should be replaced with columns of the same
            name retrieved from the autoload process.   When ``False``, columns
            already present under existing names will be omitted from the
            reflection process.

            Note that this setting does not impact :class:`_schema.Column` objects
            specified programmatically within the call to :class:`_schema.Table`
            that
            also is autoloading; those :class:`_schema.Column` objects will always
            replace existing columns of the same name when
            :paramref:`_schema.Table.extend_existing` is ``True``.

            .. seealso::

                :paramref:`_schema.Table.autoload_with`

                :paramref:`_schema.Table.extend_existing`

        :param autoload_with: An :class:`_engine.Engine` or
            :class:`_engine.Connection` object,
            or a :class:`_reflection.Inspector` object as returned by
            :func:`_sa.inspect`
            against one, with which this :class:`_schema.Table`
            object will be reflected.
            When set to a non-None value, the autoload process will take place
            for this table against the given engine or connection.

            .. seealso::

                :ref:`metadata_reflection_toplevel`

                :meth:`_events.DDLEvents.column_reflect`

                :ref:`metadata_reflection_dbagnostic_types`

        :param extend_existing: When ``True``, indicates that if this
            :class:`_schema.Table` is already present in the given
            :class:`_schema.MetaData`,
            apply further arguments within the constructor to the existing
            :class:`_schema.Table`.

            If :paramref:`_schema.Table.extend_existing` or
            :paramref:`_schema.Table.keep_existing` are not set,
            and the given name
            of the new :class:`_schema.Table` refers to a :class:`_schema.Table`
            that is
            already present in the target :class:`_schema.MetaData` collection,
            and
            this :class:`_schema.Table`
            specifies additional columns or other constructs
            or flags that modify the table's state, an
            error is raised.  The purpose of these two mutually-exclusive flags
            is to specify what action should be taken when a
            :class:`_schema.Table`
            is specified that matches an existing :class:`_schema.Table`,
            yet specifies
            additional constructs.

            :paramref:`_schema.Table.extend_existing`
            will also work in conjunction
            with :paramref:`_schema.Table.autoload_with` to run a new reflection
            operation against the database, even if a :class:`_schema.Table`
            of the same name is already present in the target
            :class:`_schema.MetaData`; newly reflected :class:`_schema.Column`
            objects
            and other options will be added into the state of the
            :class:`_schema.Table`, potentially overwriting existing columns
            and options of the same name.

            As is always the case with :paramref:`_schema.Table.autoload_with`,
            :class:`_schema.Column` objects can be specified in the same
            :class:`_schema.Table`
            constructor, which will take precedence.  Below, the existing
            table ``mytable`` will be augmented with :class:`_schema.Column`
            objects
            both reflected from the database, as well as the given
            :class:`_schema.Column`
            named "y"::

                Table(
                    "mytable",
                    metadata,
                    Column("y", Integer),
                    extend_existing=True,
                    autoload_with=engine,
                )

            .. seealso::

                :paramref:`_schema.Table.autoload_with`

                :paramref:`_schema.Table.autoload_replace`

                :paramref:`_schema.Table.keep_existing`


        :param implicit_returning: True by default - indicates that
            RETURNING can be used, typically by the ORM, in order to fetch
            server-generated values such as primary key values and
            server side defaults, on those backends which support RETURNING.

            In modern SQLAlchemy there is generally no reason to alter this
            setting, except for some backend specific cases
            (see :ref:`mssql_triggers` in the SQL Server dialect documentation
            for one such example).

        :param include_columns: A list of strings indicating a subset of
            columns to be loaded via the ``autoload`` operation; table columns who
            aren't present in this list will not be represented on the resulting
            ``Table`` object. Defaults to ``None`` which indicates all columns
            should be reflected.

        :param resolve_fks: Whether or not to reflect :class:`_schema.Table`
            objects
            related to this one via :class:`_schema.ForeignKey` objects, when
            :paramref:`_schema.Table.autoload_with` is
            specified.   Defaults to True.  Set to False to disable reflection of
            related tables as :class:`_schema.ForeignKey`
            objects are encountered; may be
            used either to save on SQL calls or to avoid issues with related tables
            that can't be accessed. Note that if a related table is already present
            in the :class:`_schema.MetaData` collection, or becomes present later,
            a
            :class:`_schema.ForeignKey` object associated with this
            :class:`_schema.Table` will
            resolve to that table normally.

            .. versionadded:: 1.3

            .. seealso::

                :paramref:`.MetaData.reflect.resolve_fks`


        :param info: Optional data dictionary which will be populated into the
            :attr:`.SchemaItem.info` attribute of this object.

        :param keep_existing: When ``True``, indicates that if this Table
            is already present in the given :class:`_schema.MetaData`, ignore
            further arguments within the constructor to the existing
            :class:`_schema.Table`, and return the :class:`_schema.Table`
            object as
            originally created. This is to allow a function that wishes
            to define a new :class:`_schema.Table` on first call, but on
            subsequent calls will return the same :class:`_schema.Table`,
            without any of the declarations (particularly constraints)
            being applied a second time.

            If :paramref:`_schema.Table.extend_existing` or
            :paramref:`_schema.Table.keep_existing` are not set,
            and the given name
            of the new :class:`_schema.Table` refers to a :class:`_schema.Table`
            that is
            already present in the target :class:`_schema.MetaData` collection,
            and
            this :class:`_schema.Table`
            specifies additional columns or other constructs
            or flags that modify the table's state, an
            error is raised.  The purpose of these two mutually-exclusive flags
            is to specify what action should be taken when a
            :class:`_schema.Table`
            is specified that matches an existing :class:`_schema.Table`,
            yet specifies
            additional constructs.

            .. seealso::

                :paramref:`_schema.Table.extend_existing`

        :param listeners: A list of tuples of the form ``(<eventname>, <fn>)``
            which will be passed to :func:`.event.listen` upon construction.
            This alternate hook to :func:`.event.listen` allows the establishment
            of a listener function specific to this :class:`_schema.Table` before
            the "autoload" process begins.  Historically this has been intended
            for use with the :meth:`.DDLEvents.column_reflect` event, however
            note that this event hook may now be associated with the
            :class:`_schema.MetaData` object directly::

                def listen_for_reflect(table, column_info):
                    "handle the column reflection event"
                    # ...


                t = Table(
                    "sometable",
                    autoload_with=engine,
                    listeners=[("column_reflect", listen_for_reflect)],
                )

            .. seealso::

                :meth:`_events.DDLEvents.column_reflect`

        :param must_exist: When ``True``, indicates that this Table must already
            be present in the given :class:`_schema.MetaData` collection, else
            an exception is raised.

        :param prefixes:
            A list of strings to insert after CREATE in the CREATE TABLE
            statement.  They will be separated by spaces.

        :param quote: Force quoting of this table's name on or off, corresponding
            to ``True`` or ``False``.  When left at its default of ``None``,
            the column identifier will be quoted according to whether the name is
            case sensitive (identifiers with at least one upper case character are
            treated as case sensitive), or if it's a reserved word.  This flag
            is only needed to force quoting of a reserved word which is not known
            by the SQLAlchemy dialect.

            .. note:: setting this flag to ``False`` will not provide
              case-insensitive behavior for table reflection; table reflection
              will always search for a mixed-case name in a case sensitive
              fashion.  Case insensitive names are specified in SQLAlchemy only
              by stating the name with all lower case characters.

        :param quote_schema: same as 'quote' but applies to the schema identifier.

        :param schema: The schema name for this table, which is required if
            the table resides in a schema other than the default selected schema
            for the engine's database connection.  Defaults to ``None``.

            If the owning :class:`_schema.MetaData` of this :class:`_schema.Table`
            specifies its
            own :paramref:`_schema.MetaData.schema` parameter,
            then that schema name will
            be applied to this :class:`_schema.Table`
            if the schema parameter here is set
            to ``None``.  To set a blank schema name on a :class:`_schema.Table`
            that
            would otherwise use the schema set on the owning
            :class:`_schema.MetaData`,
            specify the special symbol :attr:`.BLANK_SCHEMA`.

            The quoting rules for the schema name are the same as those for the
            ``name`` parameter, in that quoting is applied for reserved words or
            case-sensitive names; to enable unconditional quoting for the schema
            name, specify the flag ``quote_schema=True`` to the constructor, or use
            the :class:`.quoted_name` construct to specify the name.

        :param comment: Optional string that will render an SQL comment on table
            creation.

            .. versionadded:: 1.2 Added the :paramref:`_schema.Table.comment`
                parameter
                to :class:`_schema.Table`.

        :param \**kw: Additional keyword arguments not mentioned above are
            dialect specific, and passed in the form ``<dialectname>_<argname>``.
            See the documentation regarding an individual dialect at
            :ref:`dialect_toplevel` for detail on documented arguments.

        NT)�_implicit_generatedre�
_reflect_info)r�r�r���allow_replacements�	all_namesra)�superr�r+r�rgr_rlr�r��setr�r��PrimaryKeyConstraintr�r��_extra_dependenciesrf�fullnamer�r�r�r�r1�listen�	_prefixes�
_extra_kwargs�	_autoloadr�)r�rfr�rgr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrr��evt�fn�	__class__s                        �rcr�zTable.__init__�s����H
�
�
����T�5�1�2� ��
��>�"�/�/�D�K�
�|�
#��D�K�'�L��f�c�*�*�*�%�f�l�;�D�K� $����u����5���� $�	
�
#�
#�D�
)��E���/2�u�� ��;�;�"�'+�{�{�D�I�I�>�D�M� �I�I�D�M�"4��������5�
�������D�I�� �$���R����T�3��+�%�&.��2������� �R� �
�$��N�N����%�+�'�

�
�	����
�.� �� ���	
rbc	��tj|�}|j�5}	|	j||||||��ddd�y#1swYyxYw)N�r�r�)r3�inspect�_inspection_context�
reflect_table)
r�r�r�r��exclude_columnsr�r�r��insp�	conn_insps
          rcr�zTable._autoloadrsS���!�!�-�0��
�
%�
%�
'�9��#�#�����%�+�

$�
�(�
'�
'�s�A�Ac�2�t|jd���S)zTReturn the set of constraints as a list, sorted by creation
        order.

        c��|jSrk)�_creation_order)rps rc�<lambda>z+Table._sorted_constraints.<locals>.<lambda>�s
��a�6G�6Grb�ro)�sortedr�r�s rc�_sorted_constraintszTable._sorted_constraints�s���d�&�&�,G�H�Hrbc�l�|jD�chc]}|j�|j��c}Scc}w)a�:class:`_schema.ForeignKeyConstraint` objects referred to by this
        :class:`_schema.Table`.

        This list is produced from the collection of
        :class:`_schema.ForeignKey`
        objects currently associated.


        .. seealso::

            :attr:`_schema.Table.constraints`

            :attr:`_schema.Table.foreign_keys`

            :attr:`_schema.Table.indexes`

        )r��
constraint)r��fkcs  rc�foreign_key_constraintszTable.foreign_key_constraints�s=��*�(�(�
�(���~�~�)�
�N�N�(�
�	
��
s�1c	��|jdd�}|jd|du�}|jdd�}|jdd�}|jdd�}|jdd�}|jdd	�}	|jd
d	�}
|	sJ�|
rJ�|r5||jk7r&tjd|j�d|�d
���|jdd�}|�;|jD],}|j
|vs�|jj|��.|jdd�}
dD]}||vs�tjd��|jd|j�|_|jd|j�|_	|jd|j�|_
|rJ|s$|jD�cgc]}|j
��}}nd}|j|j||||
||��|jD�cic]}|j
|��}}|jdi|��|j|d|d��ycc}wcc}w)Nr��autoloadr�Trgr�r�r�Fr�z,Can't change schema of existing table from 'z' to '�'r�r�)r�r�z2Can't redefine 'quote' or 'quote_schema' argumentsr�r�r�rar�r�)r�rgr2r�rprfr��remover�r�r�r�r�r�r�)r�r��kwargsr�rr�rgr�r�r�r�r�rpr�rorr�s                 rcr�zTable._init_existing�sK���
�
�?�D�9�
��:�:�j�-�t�*C�D��!�:�:�&8�$�?�����H�d�+���Z�Z��d�3�
��
�
�?�D�9�
�!�*�*�%6��>���
�
�?�E�:�
���� � � ��f����+��#�#�����
�V�F�8�1�6��
�
!�*�*�%6��=���&��V�V���6�6��0��M�M�(�(��+���j�j���5��,�C��f�}��'�'�H���-��z�z�)�T�\�\�:���"(�*�*� �$�"9�"9�#
����J�J�v�t�y�y�1��	��#�48�6�6�":�6�a�1�6�6�6��":�"$���N�N��
�
�����%�+�
�
�)-���/��1�Q�V�V�Q�Y��	�/�����$�V�$�����$�4�9�M��#;��0s�I�Ic�&�|j|�yrk��_validate_dialect_kwargs�r�rs  rcr�zTable._extra_kwargs�����%�%�f�-rbc��yrkrar�s rc�_init_collectionszTable._init_collections����rbc��yrkrar�s rc�_reset_exportedzTable._reset_exported�rrbc�.�|jjSrk)r��_autoincrement_columnr�s rcr!zTable._autoincrement_column�s�����5�5�5rbc���d}d}d}|j}|�|f}d}|j}|r||ur|�J�d}n	|�|�|f}d}tj}|�r�|d}|jrI|jj
r!|rt
jd��|rd}d}d}�nOtj}�n=|j�B|j�6|jrt
jd|�d���tj}n�|j��|jjrtj}n�t|j�rF|jj
r|rt
jd��|rd}d}d}tj }na|jj"rKtj$}n:|j�.|rt
jd|d�d	���tj&}|�w|j(rk|�J�|j(D]3}|j�$|js�|jj"r�3n&t+|j(�}tj$}t-||||�S)
adetermine a candidate column (or columns, in case of a client
        generated composite primary key) which can be used as an
        "insert sentinel" for an INSERT statement.

        The returned structure, :class:`_SentinelColumnCharacterization`,
        includes all the details needed by :class:`.Dialect` and
        :class:`.SQLCompiler` to determine if these column(s) can be used
        as an INSERT..RETURNING sentinel for a particular database
        dialect.

        .. versionadded:: 2.0.10

        FNTrzQCan't use IDENTITY default with negative increment as an explicit sentinel columnzColumn z� has been marked as a sentinel column with no default generation function; it at least needs to be marked nullable=False assuming user-populated sentinel values will be used.zQCan't use SEQUENCE default with negative increment as an explicit sentinel columnzn can't be a sentinel column because it uses an explicit server side default that's not the Identity() default.)r�r!r"�UNKNOWN�identity�_increment_is_negativer2r��IDENTITYr~�server_default�nullable�NONE�is_sentinel�SENTINEL_DEFAULT�default_is_sequence�SEQUENCE�is_callable�
CLIENTSIDE�
SERVERSIDEr��tupler!)	r��sentinel_is_explicit�sentinel_is_autoinc�the_sentinel�explicit_sentinel_col�autoinc_col�default_characterization�the_sentinel_zero�_pkcs	         rc� _sentinel_column_characteristicsz&Table._sentinel_column_characteristics�s���$ %��#��@D��!%� 5� 5�� �,�1�3�L�#'� ��0�0���$9�[�$H��*�*�*�"&��
"�
*�{�/F�'�>�L�"&��#C�#K�#K� �� ,�Q��� �)�)�$�-�-�D�D�+�!�5�5�G���
/�*.�K�27�/�'+��9�A�A�-�"�)�)�1�%�4�4�<�$�-�-��1�1�!�"3�!4�5G�G���5�9�9�)�#�*�*�6�$�,�,�8�8�8�I�I�-�)�):�)B�)B�C�(�0�0�G�G�/�"%�"9�"9�!K�#��
 3�.2��6;� 3�+/�L�9�A�A�-�'�.�.�:�:�8�C�C�-�#�1�1�=�'��1�1�!�,�q�/�!2�3=�=���5�?�?�)���D�$4�$4��&�&�&��(�(���&�&�2��L�L����)A�)A��	)� %�T�%5�%5�6��4�?�?�)�/�� ��$�	
�	
rbc��|jS)a�Returns the :class:`.Column` object which currently represents
        the "auto increment" column, if any, else returns None.

        This is based on the rules for :class:`.Column` as defined by the
        :paramref:`.Column.autoincrement` parameter, which generally means the
        column within a single integer column primary key constraint that is
        not constrained by a foreign key.   If the table does not have such
        a primary key constraint, then there's no "autoincrement" column.
        A :class:`.Table` may have only one column defined as the
        "autoincrement" column.

        .. versionadded:: 2.0.4

        .. seealso::

            :paramref:`.Column.autoincrement`

        )r!r�s rc�autoincrement_columnzTable.autoincrement_column|s��(�)�)�)rbc�B�t|j|j�S)a�Return the 'key' for this :class:`_schema.Table`.

        This value is used as the dictionary key within the
        :attr:`_schema.MetaData.tables` collection.   It is typically the same
        as that of :attr:`_schema.Table.name` for a table with no
        :attr:`_schema.Table.schema`
        set; otherwise it is typically of the form
        ``schemaname.tablename``.

        )rhrfrgr�s rcroz	Table.key�s���d�i�i����5�5rbc�.�ddjt|j�gt|j�gz|jD�cgc]
}t|���c}zdD�cgc]}|�dtt||������c}z�zScc}wcc}w)Nz	Table(%s)�, �rg�=)�join�reprrfr�r��getattr)r��x�ks   rcr�zTable.__repr__�s����T�Y�Y�
�$�)�)�_���D�M�M�"�#�
$� $���-��1�t�A�w��-�
.�?I�I�j��!�T�'�$��"2�3�4�j�I�
J�
�
�	
��.��Is�B
�!!Bc�B�t|j|j�Srk)rh�descriptionrgr�s rc�__str__z
Table.__str__�s���d�.�.����<�<rbc�:�|jj|�y)a�Add a 'dependency' for this Table.

        This is another Table object which must be created
        first before this one can, or dropped after this one.

        Usually, dependencies between tables are determined via
        ForeignKey objects.   However, for other situations that
        create dependencies outside of foreign keys (rules, inheriting),
        this method can manually establish such a link.

        N)r��add�r�rns  rc�add_is_dependent_onzTable.add_is_dependent_on�s��	
� � �$�$�U�+rbc	��	|j|||jD�cic]}|j|��c}��ycc}w#tj$r+}tj|j
d�d��|�d}~wwxYw)a�Append a :class:`_schema.Column` to this :class:`_schema.Table`.

        The "key" of the newly added :class:`_schema.Column`, i.e. the
        value of its ``.key`` attribute, will then be available
        in the ``.c`` collection of this :class:`_schema.Table`, and the
        column definition will be included in any CREATE TABLE, SELECT,
        UPDATE, etc. statements generated from this :class:`_schema.Table`
        construct.

        Note that this does **not** change the definition of the table
        as it exists within any underlying database, assuming that
        table has already been created in the database.   Relational
        databases support the addition of columns to existing tables
        using the SQL ALTER command, which would need to be
        emitted for an already-existing table that doesn't contain
        the newly added column.

        :param replace_existing: When ``True``, allows replacing existing
            columns. When ``False``, the default, an warning will be raised
            if a column with the same ``.key`` already exists. A future
            version of sqlalchemy will instead rise a warning.

            .. versionadded:: 1.4.0
        r�rzV Specify replace_existing=True to Table.append_column() to replace an existing column.N)r�rprfr2�DuplicateColumnErrorr�)r��column�replace_existingrp�des     rc�
append_columnzTable.append_column�s���8	��,�,��#3�.2�f�f�5�f��1�6�6�1�9�f�5�
-�
��6���'�'�	��*�*��7�7�1�:�,�#�#���	
��	�s!�?�:�?�?�A=�&A8�8A=c�&�|j|�y)a�Append a :class:`_schema.Constraint` to this
        :class:`_schema.Table`.

        This has the effect of the constraint being included in any
        future CREATE TABLE statement, assuming specific DDL creation
        events have not been associated with the given
        :class:`_schema.Constraint` object.

        Note that this does **not** produce the constraint within the
        relational database automatically, for a table that already exists
        in the database.   To add a constraint to an
        existing relational database table, the SQL ALTER command must
        be used.  SQLAlchemy also provides the
        :class:`.AddConstraint` construct which can produce this SQL when
        invoked as an executable clause.

        N�r�)r�rs  rc�append_constraintzTable.append_constraint�s��&	�,�,�T�2rbc��|}t|t�sJ�|j|j|j|�||_yrk)rl�MetaDatar�rfrgr�)r��parentrrr�s    rc�_set_parentzTable._set_parent�s8�����(�H�-�-�-����D�I�I�t�{�{�D�9� ��
rbc�H�|jtj||��y)z�Issue a ``CREATE`` statement for this
        :class:`_schema.Table`, using the given
        :class:`.Connection` or :class:`.Engine`
        for connectivity.

        .. seealso::

            :meth:`_schema.MetaData.create_all`.

        ��
checkfirstN��_run_ddl_visitorr�SchemaGenerator�r��bindr]s   rc�createzTable.create�s��	
���c�1�1�4�J��Orbc�H�|jtj||��y)z�Issue a ``DROP`` statement for this
        :class:`_schema.Table`, using the given
        :class:`.Connection` or :class:`.Engine` for connectivity.

        .. seealso::

            :meth:`_schema.MetaData.drop_all`.

        r\N�r_r�
SchemaDropperras   rc�dropz
Table.drop���	
���c�/�/��*��Mrbr�zP:meth:`_schema.Table.tometadata` is renamed to :meth:`_schema.Table.to_metadata`c�,�|j||||��S)z�Return a copy of this :class:`_schema.Table`
        associated with a different
        :class:`_schema.MetaData`.

        See :meth:`_schema.Table.to_metadata` for a full description.

        )rg�referred_schema_fnrf)�to_metadata)r�r�rgrjrfs     rc�
tometadatazTable.tometadatas(��0�����1��	 �
�	
rbc�"�|�|j}|tur
|j}n|�
|j}n|}t||�}||jvr2tjd|j�d��|j|Sg}|jD]$}|j|j||����&t||g|��||jd�|j��}	|jD]�}
t|
t �rP|
j"}|r||||
|�}n||jk(r|nd}|	j%|
j||	����c|
j&r�p|
j(r�}|	j%|
j||	�����|j*D]b}
|
j(r�t-|
jg|
j.D�cgc]}t1|||	���c}��|
j2|	d�|
j���d|j5|	�Scc}w)a@Return a copy of this :class:`_schema.Table` associated with a
        different :class:`_schema.MetaData`.

        E.g.::

            m1 = MetaData()

            user = Table("user", m1, Column("id", Integer, primary_key=True))

            m2 = MetaData()
            user_copy = user.to_metadata(m2)

        .. versionchanged:: 1.4  The :meth:`_schema.Table.to_metadata` function
           was renamed from :meth:`_schema.Table.tometadata`.


        :param metadata: Target :class:`_schema.MetaData` object,
         into which the
         new :class:`_schema.Table` object will be created.

        :param schema: optional string name indicating the target schema.
         Defaults to the special symbol :attr:`.RETAIN_SCHEMA` which indicates
         that no change to the schema name should be made in the new
         :class:`_schema.Table`.  If set to a string name, the new
         :class:`_schema.Table`
         will have this new name as the ``.schema``.  If set to ``None``, the
         schema will be set to that of the schema set on the target
         :class:`_schema.MetaData`, which is typically ``None`` as well,
         unless
         set explicitly::

            m2 = MetaData(schema="newschema")

            # user_copy_one will have "newschema" as the schema name
            user_copy_one = user.to_metadata(m2, schema=None)

            m3 = MetaData()  # schema defaults to None

            # user_copy_two will have None as the schema name
            user_copy_two = user.to_metadata(m3, schema=None)

        :param referred_schema_fn: optional callable which can be supplied
         in order to provide for the schema name that should be assigned
         to the referenced table of a :class:`_schema.ForeignKeyConstraint`.
         The callable accepts this parent :class:`_schema.Table`, the
         target schema that we are changing to, the
         :class:`_schema.ForeignKeyConstraint` object, and the existing
         "target schema" of that constraint.  The function should return the
         string schema name that should be applied.    To reset the schema
         to "none", return the symbol :data:`.BLANK_SCHEMA`.  To effect no
         change, return ``None`` or :data:`.RETAIN_SCHEMA`.

         .. versionchanged:: 1.4.33  The ``referred_schema_fn`` function
            may return the :data:`.BLANK_SCHEMA` or :data:`.RETAIN_SCHEMA`
            symbols.

         E.g.::

                def referred_schema_fn(table, to_schema, constraint, referred_schema):
                    if referred_schema == "base_tables":
                        return referred_schema
                    else:
                        return to_schema


                new_table = table.to_metadata(
                    m2, schema="alt_schema", referred_schema_fn=referred_schema_fn
                )

        :param name: optional string name indicating the target table name.
         If not specified or None, the table name is retained.  This allows
         a :class:`_schema.Table` to be copied to the same
         :class:`_schema.MetaData` target
         with a new name.

        Nr�z9' already exists within the given MetaData - not copying.)rg�_to_metadata)rgr��rgrz)�unique�_table)rfr^rgrhr�r4�warnrHr��append�_copyrVr�rr�rl�ForeignKeyConstraint�_referred_schemarV�_type_bound�_column_flagr��Index�_table_bound_expressionsr{rpr�)r�r�rgrjrf�
actual_schemaror��colrn�const�referred_schema�fk_constraint_schema�index�exprs               rcrkzTable.to_metadata6s7��p�<��9�9�D��]�"� �K�K�M�
�^�$�O�O�M�"�M��T�=�1���(�/�/�!��I�I��$�*�*�+�,*�*�
��?�?�3�'�'����<�<�C��K�K��	�	��X�	�N�O� ����
�
�
�!��L�L�	
��k�k�

���%�%�E��%�!5�6�"'�"8�"8��%�+=��m�U�O�,�(�+�d�k�k�9�&�!�)�
�'�'��K�K�3�%� ���
�&�&��%�%���'�'��K�K�}�5�K�I��1&�6�\�\�E��!�!����
�
�	
�
!&� >� >�� >��%�T�4��7� >��	
��|�|�
�	
��,�,�	
�"��%�%�e�,�,��s�H)rvr�)rv�Set[ForeignKey]�rv�*ReadOnlyColumnCollection[str, Column[Any]])rHrHr�zList[BindParameter[Any]]rvzTuple[Any, ...])r�rrrrrvr)*rfr�r�rXr�rTrg�7Optional[Union[str, Literal[SchemaConst.BLANK_SCHEMA]]]r��Optional[bool]r�r�r�z#Optional[Union[Engine, Connection]]r�r�r�r�r�r�r�r�r��Optional[Collection[str]]r�r�r�r�r�zOptional[Dict[Any, Any]]r�z:Optional[_typing_Sequence[Tuple[str, Callable[..., Any]]]]r�zOptional[_typing_Sequence[str]]r��Optional[Set[Table]]r�r�rrrrvr�)raTNN)r�rXr��Union[Engine, Connection]r�r�rzCollection[str]r�r�r�r�r�z_ReflectionInfo | Nonervr�)rvzList[Constraint])rvzSet[ForeignKeyConstraint])r�rrrrvr��rrrvr��rvr��rvzOptional[Column[int]])rvr!r��rnrVrvr��F)rPzColumnClause[Any]rQr�rvr�)rzUnion[Index, Constraint]rvr��rYr&rrrrvr��rb�_CreateDropBindr]r�rvr�)
r�rXrgz.Union[str, Literal[SchemaConst.RETAIN_SCHEMA]]rjz^Optional[Callable[[Table, Optional[str], ForeignKeyConstraint, Optional[str]], Optional[str]]]rfr�rvrV)/r[r\r]r�r�rr4�ro_non_memoized_propertyr�r�r�r�r�rpr��typing�deprecated_paramsr��classmethodr�r�r��propertyrrr�r�rrr!�ro_memoized_propertyr:r<ror�rIrMrSrVrZrcrg�
deprecatedr^rlrk�
__classcell__�r�s@rcrVrV=s7����4�N��	
�	&�	&�:�
'�:�	
�	&�	&�6�
'�6�1�1�+�+� � ��6����	
�	&�	&�L�
'�L�	
�	&�	&�	=�
7�	=�
'�	=�
�	&�	&�F�
'�F�� ��.F��	�����
 ��	�	��

�	)�


�	)��49��49�vKO� $�'+�=A�!%�#� %� �59�#'�!%�)-�
�48�+/��1I
��I
��I
��	I
�
H�I
��
I
�%�I
�;�I
��I
��I
��I
��I
�3�I
�!�I
��I
� '�!I
�"
�#I
�(2�)I
�,)�-I
�0�1I
�4�5I
�6
�7I
�`,.� �+/�04����1��3�	�
)���
�)��.��
��*�I��I��
��
�0@N�D.�
�
�
�"�"�6�#�6�
���A
�	(�A
��A
�F�*��*�*�6��6�
�=�,�CH�'�'�'�;?�'�	
�'�R3�*!�P�
N��T�_�_�
�	,��BO�
�"�
��
�?�
�
�	
��
�
�
��

�:BO�
�"�`-��`-�?�`-�
�	`-��`-�
�`-rbc���eZdZUdZdZdZded<ded<		d,ddd	ejejddddde	jdd
dddd
dd
d
dd�																																																	d-�fd�Zded<ded<ded<	d
ed<	d
ed<	ded<ded<d.d�Ze
jd/d��Ze
jd/d��Zej$d0d��Zd1d�Zd2d�Zd3d �Zd4d!�Zd2d"�Z										d5d#�Zd6d$�Zd6d%�Zej8d&d'�d7d(��Zd7d)�Zd8d*�Z				d9																	d:d+�Z �xZ!S);rmz(Represents a column in a database table.rPTr�rozOptional[FetchedValue]r'N�autoF)rf�type_�
autoincrementr~�insert_default�docror�rpr�r(�onupdater�r'�server_onupdater��systemr��insert_sentinel�_omit_from_statements�_proxiesr�r�rpc����||gt|�z}~|rRt|dt�r)|�tjd��|jd�}n|d�|jd�|rP|d}t
|d�r)|�tjd��|jd�}n|d�|jd�|�
t||�}n|�tjd��t�|�%||�|	�|	n||_
||_||_||_
|
x|_}|tur||_n||_|
|_||_||_||_||_t-�|_t-�|_||_d|_d|_|�||_n|j;|j<�|t>j@ur|}n|t>j@ur|}nd}|�:t|tBtDf�stC|�}||_#|jI|�nd|_#|�<t|tBtDf�s
tC|d��}||_%|jI|�nd|_%|�Ot|tL�r#|jOd	�}|jI|�ntQ|�}|jI|�||_)|�Qt|tL�r#|jOd�}|jI|�ntQ|d��}|jI|�||_*|jVtYtZt\|��t_j`|�|�||_1|jdd
i|��y)a�b
        Construct a new ``Column`` object.

        :param name: The name of this column as represented in the database.
          This argument may be the first positional argument, or specified
          via keyword.

          Names which contain no upper case characters
          will be treated as case insensitive names, and will not be quoted
          unless they are a reserved word.  Names with any number of upper
          case characters will be quoted and sent exactly.  Note that this
          behavior applies even for databases which standardize upper
          case names as case insensitive such as Oracle Database.

          The name field may be omitted at construction time and applied
          later, at any time before the Column is associated with a
          :class:`_schema.Table`.  This is to support convenient
          usage within the :mod:`~sqlalchemy.ext.declarative` extension.

        :param type\_: The column's type, indicated using an instance which
          subclasses :class:`~sqlalchemy.types.TypeEngine`.  If no arguments
          are required for the type, the class of the type can be sent
          as well, e.g.::

            # use a type with arguments
            Column("data", String(50))

            # use no arguments
            Column("level", Integer)

          The ``type`` argument may be the second positional argument
          or specified by keyword.

          If the ``type`` is ``None`` or is omitted, it will first default to
          the special type :class:`.NullType`.  If and when this
          :class:`_schema.Column` is made to refer to another column using
          :class:`_schema.ForeignKey` and/or
          :class:`_schema.ForeignKeyConstraint`, the type
          of the remote-referenced column will be copied to this column as
          well, at the moment that the foreign key is resolved against that
          remote :class:`_schema.Column` object.

        :param \*args: Additional positional arguments include various
          :class:`.SchemaItem` derived constructs which will be applied
          as options to the column.  These include instances of
          :class:`.Constraint`, :class:`_schema.ForeignKey`,
          :class:`.ColumnDefault`, :class:`.Sequence`, :class:`.Computed`
          :class:`.Identity`.  In some cases an
          equivalent keyword argument is available such as ``server_default``,
          ``default`` and ``unique``.

        :param autoincrement: Set up "auto increment" semantics for an
          **integer primary key column with no foreign key dependencies**
          (see later in this docstring for a more specific definition).
          This may influence the :term:`DDL` that will be emitted for
          this column during a table create, as well as how the column
          will be considered when INSERT statements are compiled and
          executed.

          The default value is the string ``"auto"``,
          which indicates that a single-column (i.e. non-composite) primary key
          that is of an INTEGER type with no other client-side or server-side
          default constructs indicated should receive auto increment semantics
          automatically. Other values include ``True`` (force this column to
          have auto-increment semantics for a :term:`composite primary key` as
          well), ``False`` (this column should never have auto-increment
          semantics), and the string ``"ignore_fk"`` (special-case for foreign
          key columns, see below).

          The term "auto increment semantics" refers both to the kind of DDL
          that will be emitted for the column within a CREATE TABLE statement,
          when methods such as :meth:`.MetaData.create_all` and
          :meth:`.Table.create` are invoked, as well as how the column will be
          considered when an INSERT statement is compiled and emitted to the
          database:

          * **DDL rendering** (i.e. :meth:`.MetaData.create_all`,
            :meth:`.Table.create`): When used on a :class:`.Column` that has
            no other
            default-generating construct associated with it (such as a
            :class:`.Sequence` or :class:`.Identity` construct), the parameter
            will imply that database-specific keywords such as PostgreSQL
            ``SERIAL``, MySQL ``AUTO_INCREMENT``, or ``IDENTITY`` on SQL Server
            should also be rendered.  Not every database backend has an
            "implied" default generator available; for example the Oracle Database
            backends alway needs an explicit construct such as
            :class:`.Identity` to be included with a :class:`.Column` in order
            for the DDL rendered to include auto-generating constructs to also
            be produced in the database.

          * **INSERT semantics** (i.e. when a :func:`_sql.insert` construct is
            compiled into a SQL string and is then executed on a database using
            :meth:`_engine.Connection.execute` or equivalent): A single-row
            INSERT statement will be known to produce a new integer primary key
            value automatically for this column, which will be accessible
            after the statement is invoked via the
            :attr:`.CursorResult.inserted_primary_key` attribute upon the
            :class:`_result.Result` object.   This also applies towards use of the
            ORM when ORM-mapped objects are persisted to the database,
            indicating that a new integer primary key will be available to
            become part of the :term:`identity key` for that object.  This
            behavior takes place regardless of what DDL constructs are
            associated with the :class:`_schema.Column` and is independent
            of the "DDL Rendering" behavior discussed in the previous note
            above.

          The parameter may be set to ``True`` to indicate that a column which
          is part of a composite (i.e. multi-column) primary key should
          have autoincrement semantics, though note that only one column
          within a primary key may have this setting.    It can also
          be set to ``True`` to indicate autoincrement semantics on a
          column that has a client-side or server-side default configured,
          however note that not all dialects can accommodate all styles
          of default as an "autoincrement".  It can also be
          set to ``False`` on a single-column primary key that has a
          datatype of INTEGER in order to disable auto increment semantics
          for that column.

          The setting *only* has an effect for columns which are:

          * Integer derived (i.e. INT, SMALLINT, BIGINT).

          * Part of the primary key

          * Not referring to another column via :class:`_schema.ForeignKey`,
            unless
            the value is specified as ``'ignore_fk'``::

                # turn on autoincrement for this column despite
                # the ForeignKey()
                Column(
                    "id",
                    ForeignKey("other.id"),
                    primary_key=True,
                    autoincrement="ignore_fk",
                )

          It is typically not desirable to have "autoincrement" enabled on a
          column that refers to another via foreign key, as such a column is
          required to refer to a value that originates from elsewhere.

          The setting has these effects on columns that meet the
          above criteria:

          * DDL issued for the column, if the column does not already include
            a default generating construct supported by the backend such as
            :class:`.Identity`, will include database-specific
            keywords intended to signify this column as an
            "autoincrement" column for specific backends.   Behavior for
            primary SQLAlchemy dialects includes:

            * AUTO INCREMENT on MySQL and MariaDB
            * SERIAL on PostgreSQL
            * IDENTITY on MS-SQL - this occurs even without the
              :class:`.Identity` construct as the
              :paramref:`.Column.autoincrement` parameter pre-dates this
              construct.
            * SQLite - SQLite integer primary key columns are implicitly
              "auto incrementing" and no additional keywords are rendered;
              to render the special SQLite keyword ``AUTOINCREMENT``
              is not included as this is unnecessary and not recommended
              by the database vendor.  See the section
              :ref:`sqlite_autoincrement` for more background.
            * Oracle Database - The Oracle Database dialects have no default "autoincrement"
              feature available at this time, instead the :class:`.Identity`
              construct is recommended to achieve this (the :class:`.Sequence`
              construct may also be used).
            * Third-party dialects - consult those dialects' documentation
              for details on their specific behaviors.

          * When a single-row :func:`_sql.insert` construct is compiled and
            executed, which does not set the :meth:`_sql.Insert.inline`
            modifier, newly generated primary key values for this column
            will be automatically retrieved upon statement execution
            using a method specific to the database driver in use:

            * MySQL, SQLite - calling upon ``cursor.lastrowid()``
              (see
              `https://www.python.org/dev/peps/pep-0249/#lastrowid
              <https://www.python.org/dev/peps/pep-0249/#lastrowid>`_)
            * PostgreSQL, SQL Server, Oracle Database - use RETURNING or an equivalent
              construct when rendering an INSERT statement, and then retrieving
              the newly generated primary key values after execution
            * PostgreSQL, Oracle Database for :class:`_schema.Table` objects that
              set :paramref:`_schema.Table.implicit_returning` to False -
              for a :class:`.Sequence` only, the :class:`.Sequence` is invoked
              explicitly before the INSERT statement takes place so that the
              newly generated primary key value is available to the client
            * SQL Server for :class:`_schema.Table` objects that
              set :paramref:`_schema.Table.implicit_returning` to False -
              the ``SELECT scope_identity()`` construct is used after the
              INSERT statement is invoked to retrieve the newly generated
              primary key value.
            * Third-party dialects - consult those dialects' documentation
              for details on their specific behaviors.

          * For multiple-row :func:`_sql.insert` constructs invoked with
            a list of parameters (i.e. "executemany" semantics), primary-key
            retrieving behaviors are generally disabled, however there may
            be special APIs that may be used to retrieve lists of new
            primary key values for an "executemany", such as the psycopg2
            "fast insertmany" feature.  Such features are very new and
            may not yet be well covered in documentation.

        :param default: A scalar, Python callable, or
            :class:`_expression.ColumnElement` expression representing the
            *default value* for this column, which will be invoked upon insert
            if this column is otherwise not specified in the VALUES clause of
            the insert. This is a shortcut to using :class:`.ColumnDefault` as
            a positional argument; see that class for full detail on the
            structure of the argument.

            Contrast this argument to
            :paramref:`_schema.Column.server_default`
            which creates a default generator on the database side.

            .. seealso::

                :ref:`metadata_defaults_toplevel`

        :param insert_default: An alias of :paramref:`.Column.default`
            for compatibility with :func:`_orm.mapped_column`.

            .. versionadded: 2.0.31

        :param doc: optional String that can be used by the ORM or similar
            to document attributes on the Python side.   This attribute does
            **not** render SQL comments; use the
            :paramref:`_schema.Column.comment`
            parameter for this purpose.

        :param key: An optional string identifier which will identify this
            ``Column`` object on the :class:`_schema.Table`.
            When a key is provided,
            this is the only identifier referencing the ``Column`` within the
            application, including ORM attribute mapping; the ``name`` field
            is used only when rendering SQL.

        :param index: When ``True``, indicates that a :class:`_schema.Index`
            construct will be automatically generated for this
            :class:`_schema.Column`, which will result in a "CREATE INDEX"
            statement being emitted for the :class:`_schema.Table` when the DDL
            create operation is invoked.

            Using this flag is equivalent to making use of the
            :class:`_schema.Index` construct explicitly at the level of the
            :class:`_schema.Table` construct itself::

                Table(
                    "some_table",
                    metadata,
                    Column("x", Integer),
                    Index("ix_some_table_x", "x"),
                )

            To add the :paramref:`_schema.Index.unique` flag to the
            :class:`_schema.Index`, set both the
            :paramref:`_schema.Column.unique` and
            :paramref:`_schema.Column.index` flags to True simultaneously,
            which will have the effect of rendering the "CREATE UNIQUE INDEX"
            DDL instruction instead of "CREATE INDEX".

            The name of the index is generated using the
            :ref:`default naming convention <constraint_default_naming_convention>`
            which for the :class:`_schema.Index` construct is of the form
            ``ix_<tablename>_<columnname>``.

            As this flag is intended only as a convenience for the common case
            of adding a single-column, default configured index to a table
            definition, explicit use of the :class:`_schema.Index` construct
            should be preferred for most use cases, including composite indexes
            that encompass more than one column, indexes with SQL expressions
            or ordering, backend-specific index configuration options, and
            indexes that use a specific name.

            .. note:: the :attr:`_schema.Column.index` attribute on
               :class:`_schema.Column`
               **does not indicate** if this column is indexed or not, only
               if this flag was explicitly set here.  To view indexes on
               a column, view the :attr:`_schema.Table.indexes` collection
               or use :meth:`_reflection.Inspector.get_indexes`.

            .. seealso::

                :ref:`schema_indexes`

                :ref:`constraint_naming_conventions`

                :paramref:`_schema.Column.unique`

        :param info: Optional data dictionary which will be populated into the
            :attr:`.SchemaItem.info` attribute of this object.

        :param nullable: When set to ``False``, will cause the "NOT NULL"
            phrase to be added when generating DDL for the column.   When
            ``True``, will normally generate nothing (in SQL this defaults to
            "NULL"), except in some very specific backend-specific edge cases
            where "NULL" may render explicitly.
            Defaults to ``True`` unless :paramref:`_schema.Column.primary_key`
            is also ``True`` or the column specifies a :class:`_sql.Identity`,
            in which case it defaults to ``False``.
            This parameter is only used when issuing CREATE TABLE statements.

            .. note::

                When the column specifies a :class:`_sql.Identity` this
                parameter is in general ignored by the DDL compiler. The
                PostgreSQL database allows nullable identity column by
                setting this parameter to ``True`` explicitly.

        :param onupdate: A scalar, Python callable, or
            :class:`~sqlalchemy.sql.expression.ClauseElement` representing a
            default value to be applied to the column within UPDATE
            statements, which will be invoked upon update if this column is not
            present in the SET clause of the update. This is a shortcut to
            using :class:`.ColumnDefault` as a positional argument with
            ``for_update=True``.

            .. seealso::

                :ref:`metadata_defaults` - complete discussion of onupdate

        :param primary_key: If ``True``, marks this column as a primary key
            column. Multiple columns can have this flag set to specify
            composite primary keys. As an alternative, the primary key of a
            :class:`_schema.Table` can be specified via an explicit
            :class:`.PrimaryKeyConstraint` object.

        :param server_default: A :class:`.FetchedValue` instance, str, Unicode
            or :func:`~sqlalchemy.sql.expression.text` construct representing
            the DDL DEFAULT value for the column.

            String types will be emitted as-is, surrounded by single quotes::

                Column("x", Text, server_default="val")

            will render:

            .. sourcecode:: sql

                x TEXT DEFAULT 'val'

            A :func:`~sqlalchemy.sql.expression.text` expression will be
            rendered as-is, without quotes::

                Column("y", DateTime, server_default=text("NOW()"))

            will render:

            .. sourcecode:: sql

                y DATETIME DEFAULT NOW()

            Strings and text() will be converted into a
            :class:`.DefaultClause` object upon initialization.

            This parameter can also accept complex combinations of contextually
            valid SQLAlchemy expressions or constructs::

                from sqlalchemy import create_engine
                from sqlalchemy import Table, Column, MetaData, ARRAY, Text
                from sqlalchemy.dialects.postgresql import array

                engine = create_engine(
                    "postgresql+psycopg2://scott:tiger@localhost/mydatabase"
                )
                metadata_obj = MetaData()
                tbl = Table(
                    "foo",
                    metadata_obj,
                    Column(
                        "bar", ARRAY(Text), server_default=array(["biz", "bang", "bash"])
                    ),
                )
                metadata_obj.create_all(engine)

            The above results in a table created with the following SQL:

            .. sourcecode:: sql

                CREATE TABLE foo (
                    bar TEXT[] DEFAULT ARRAY['biz', 'bang', 'bash']
                )

            Use :class:`.FetchedValue` to indicate that an already-existing
            column will generate a default value on the database side which
            will be available to SQLAlchemy for post-fetch after inserts. This
            construct does not specify any DDL and the implementation is left
            to the database, such as via a trigger.

            .. seealso::

                :ref:`server_defaults` - complete discussion of server side
                defaults

        :param server_onupdate: A :class:`.FetchedValue` instance
            representing a database-side default generation function,
            such as a trigger. This
            indicates to SQLAlchemy that a newly generated value will be
            available after updates. This construct does not actually
            implement any kind of generation function within the database,
            which instead must be specified separately.


            .. warning:: This directive **does not** currently produce MySQL's
               "ON UPDATE CURRENT_TIMESTAMP()" clause.  See
               :ref:`mysql_timestamp_onupdate` for background on how to
               produce this clause.

            .. seealso::

                :ref:`triggered_columns`

        :param quote: Force quoting of this column's name on or off,
             corresponding to ``True`` or ``False``. When left at its default
             of ``None``, the column identifier will be quoted according to
             whether the name is case sensitive (identifiers with at least one
             upper case character are treated as case sensitive), or if it's a
             reserved word. This flag is only needed to force quoting of a
             reserved word which is not known by the SQLAlchemy dialect.

        :param unique: When ``True``, and the :paramref:`_schema.Column.index`
            parameter is left at its default value of ``False``,
            indicates that a :class:`_schema.UniqueConstraint`
            construct will be automatically generated for this
            :class:`_schema.Column`,
            which will result in a "UNIQUE CONSTRAINT" clause referring
            to this column being included
            in the ``CREATE TABLE`` statement emitted, when the DDL create
            operation for the :class:`_schema.Table` object is invoked.

            When this flag is ``True`` while the
            :paramref:`_schema.Column.index` parameter is simultaneously
            set to ``True``, the effect instead is that a
            :class:`_schema.Index` construct which includes the
            :paramref:`_schema.Index.unique` parameter set to ``True``
            is generated.  See the documentation for
            :paramref:`_schema.Column.index` for additional detail.

            Using this flag is equivalent to making use of the
            :class:`_schema.UniqueConstraint` construct explicitly at the
            level of the :class:`_schema.Table` construct itself::

                Table("some_table", metadata, Column("x", Integer), UniqueConstraint("x"))

            The :paramref:`_schema.UniqueConstraint.name` parameter
            of the unique constraint object is left at its default value
            of ``None``; in the absence of a :ref:`naming convention <constraint_naming_conventions>`
            for the enclosing :class:`_schema.MetaData`, the UNIQUE CONSTRAINT
            construct will be emitted as unnamed, which typically invokes
            a database-specific naming convention to take place.

            As this flag is intended only as a convenience for the common case
            of adding a single-column, default configured unique constraint to a table
            definition, explicit use of the :class:`_schema.UniqueConstraint` construct
            should be preferred for most use cases, including composite constraints
            that encompass more than one column, backend-specific index configuration options, and
            constraints that use a specific name.

            .. note:: the :attr:`_schema.Column.unique` attribute on
                :class:`_schema.Column`
                **does not indicate** if this column has a unique constraint or
                not, only if this flag was explicitly set here.  To view
                indexes and unique constraints that may involve this column,
                view the
                :attr:`_schema.Table.indexes` and/or
                :attr:`_schema.Table.constraints` collections or use
                :meth:`_reflection.Inspector.get_indexes` and/or
                :meth:`_reflection.Inspector.get_unique_constraints`

            .. seealso::

                :ref:`schema_unique_constraint`

                :ref:`constraint_naming_conventions`

                :paramref:`_schema.Column.index`

        :param system: When ``True``, indicates this is a "system" column,
             that is a column which is automatically made available by the
             database, and should not be included in the columns list for a
             ``CREATE TABLE`` statement.

             For more elaborate scenarios where columns should be
             conditionally rendered differently on different backends,
             consider custom compilation rules for :class:`.CreateColumn`.

        :param comment: Optional string that will render an SQL comment on
             table creation.

             .. versionadded:: 1.2 Added the
                :paramref:`_schema.Column.comment`
                parameter to :class:`_schema.Column`.

        :param insert_sentinel: Marks this :class:`_schema.Column` as an
         :term:`insert sentinel` used for optimizing the performance of the
         :term:`insertmanyvalues` feature for tables that don't
         otherwise have qualifying primary key configurations.

         .. versionadded:: 2.0.10

         .. seealso::

            :func:`_schema.insert_sentinel` - all in one helper for declaring
            sentinel columns

            :ref:`engine_insertmanyvalues`

            :ref:`engine_insertmanyvalues_sentinel_columns`


        rNz0May not pass name positionally and as a keyword.�
_sqla_typez1May not pass type_ positionally and as a keyword.z9Explicit 'name' is required when sending 'quote' argumentT��
for_updateFra)3�listrlr�r2r�r��hasattrr+r�r�ror��_insert_sentinelr��_user_defined_nullabler`r(r�rpr�r�r�r�r�r�r��computedr$r��	_set_type�typer�NO_ARG�
ColumnDefaultrr~rsr�rW�_as_for_update�
DefaultClauser'r�r�r�_typing_SequencerTr4�set_creation_orderr�r�)r��_Column__name_pos�_Column__type_posrfr�r�r~r�r�ror�rpr�r(r�r�r'r�r�r�r�r�r�r�r��dialect_kwargs�l_args�coltype�udn�resolved_defaultr�s                              �rcr�zColumn.__init__�sE���F�j�)�D��J�6�����&��)�S�)��#��+�+�J����z�z�!�}�����"��
�
�1�
���Q�i�G��w��-��$��+�+�K����
�
�1�
�����"��
�
�1�
����t�U�+�D�
�
��#�#�K��
�	����u�%��/�3�t���&��� /���%:��"�,4�4��#�c��&�&��D�M� +�O�D�M�
��
����������1>����5����E��������
���
���$�D�M�
�N�N�4�9�9�%�����.�-��
�F�M�M�
)�&��#���'��.���0I�J�#0�1A�#B� �+�D�L��M�M�*�+��D�L����h���(A�B�(��d�C��$�D�M��M�M�(�#� �D�M��%��.�,�7�!/�!>�!>�u�!E���
�
�n�-�!.�~�!>���
�
�n�-�,����&��/�<�8�"1�"@�"@��"F���
�
�o�.�"/�#��#���
�
�o�.�.�������$�/�
�;�V�D�E�����%����D�I�����,�^�,rbrVrnr�r�r�r�zOptional[Computed]r�zOptional[Identity]r$c�^�|jjs||jusJ�||_t|jt�r|jj	|�|jj
j
�D]$}t|t�s�|j	|��&yrk)r��_isnullrlr&r��_variant_mapping�values)r�r��impls   rcr�zColumn._set_type�s~���y�y� � �E�T�Y�Y�$6�6�6���	��d�i�i�!2�3��I�I�/�/��5��I�I�.�.�5�5�7�D��$� 1�2��.�.�t�4�8rbc�@�tj|j�S�z1used by default.py -> _process_execute_defaults())r�_from_column_defaultr~r�s rc�_default_description_tuplez!Column._default_description_tuple�s��(�<�<�T�\�\�J�Jrbc�@�tj|j�Sr�)rr�r�r�s rc�_onupdate_description_tuplez"Column._onupdate_description_tuple�s��(�<�<�T�]�]�K�Krbc�N�|jduxr|jjS)z�special attribute used by cache key gen, if true, we will
        use a static cache key for the annotations dictionary, else we
        will generate a new cache key for annotations each time.

        Added for #8790

        N)rn�	_is_tabler�s rc�!_gen_static_annotations_cache_keyz(Column._gen_static_annotations_cache_key�s"���z�z��%�>�$�*�*�*>�*>�>rbc�&�|j|�yrkrrs  rcr�zColumn._extra_kwargs�rrbc���|j�y|j�H|jjr&|jjdz|jzS|jS|jS)Nz	(no name)re)rfrn�named_with_columnrHr�s rcrIzColumn.__str__�s^���9�9���
�Z�Z�
#��z�z�+�+��z�z�-�-��3�d�6F�6F�F�F��'�'�'��#�#�#rbc��|jD]3}|jjj|j�s�3yy)zOReturn True if this Column references the given column via foreign
        key.TF)r�rP�	proxy_set�intersection�r�rP�fks   rc�
referenceszColumn.references�s:���#�#�B��y�y�"�"�/�/��0@�0@�A��$�rbc�&�|j|�yrkrU)r�r�s  rc�append_foreign_keyzColumn.append_foreign_key�s��
�$�$�T�*rbc��g}|j|jk7r|jd�|jr|jd�|js|jd�|j
r|jd�|jr|jd�|jr|jd�|jr|jd�dd	jt|j�gt|j�gz|jD�cgc]}|��t|���c}z|jD�cgc]
}t|���c}z|jduxrd
|jjzxsdgz|D�cgc]}|�dtt!||������c}z�zScc}wcc}wcc}w)
Nror�r(r�r~r'r�z
Column(%s)r?z
table=<%s>z
table=NonerA)rorfrsr�r(r�r~r'r�rBrCr�r�r�rnrHrD)r��kwargrErFs    rcr�zColumn.__repr__�s������8�8�t�y�y� ��L�L�������L�L��'��}�}��L�L��$��=�=��L�L��$��<�<��L�L��#�����L�L�)�*��<�<��L�L��#��d�i�i�
�$�)�)�_���D�I�I���
 � $� 1� 1�C� 1�1�Q�]�t�A�w� 1�C�
D�!%� 0� 0�1� 0�1�t�A�w� 0�1�
2��J�J�d�*�>�$�t�z�z�'=�'=�=�$�#�	�	

�?D�D�e��!�T�'�$��"2�3�4�e�D�
E�

�

�
	
��D��1��Es�!F=�)
F=�G�!Gc	��
�|�
t�
t�sJ�|jstjd��|j�|j�|j|_t|dd�}|�4|�
ur0tjd|j�d|j�d���d}d}d}|j�
jvr8�
j|j}|j|jk(rd}n%d}n"|j|vr||j}|h}d}|��||ur�|sDtjd	|�d
|dk(r|jn|j�d�
j�d���|jD][}	�
jj|	�|	j�
jvs�7�
jj|	j��]|rX|�V|j|jk(r=tj d
|j�d|j�d|j�d���
jj#||��|||j<�
|_|j&r<|j$j(�tjd��||j$_|j*r�
j*j-|�nH|j�
j*vr0tjd|j�d�
j.�d���|j0rkt|j0t2�rtjd���
j5t7d|jt9|j:�d���na|j:rUt|j:t2�rtjd���
j5t=|jd���|j?�
fd��|j@rJt|jBtD�st|jFtD�rtjd��yy)NzfColumn must be constructed with a non-blank name or assign a non-blank .name before adding to a Table.rnzColumn object 'z' already assigned to Table 'r�rfrozA column with z 'z' is already present in table '�'.z Column with user-specified key "z-" is being replaced with plain named column "z", key "zs" is being removed.  If this is a reflection operation, specify autoload_replace=False to prevent this replacement.)�extra_removez2a Table may have only one explicit sentinel columnz'Trying to redefine primary-key column 'z(' as a non-primary-key column on table 'z�The 'index' keyword argument on Column is boolean only. To create indexes with a specific name, create an explicit Index object external to the Table.T)rprxz�The 'unique' keyword argument on Column is boolean only. To create unique constraints or indexes with a specific name, append an explicit UniqueConstraint to the Table's list of elements, or create an explicit Index object external to the Table.)rxc�&��|j��Srk)�_set_remote_table)r�rns �rcr	z$Column._set_parent.<locals>.<lambda>}	s���r�/C�/C�E�/Jrbz4An column cannot specify both Identity and Sequence.)$rlrVrfr2r��_reset_memoizationsrorDrHr�rOr�rrr�r4rrrurnr�r�r��_replacer�r�r�rVryr�rp�UniqueConstraint�_setup_on_memoized_fksr$r~rr�)r�rYr�r�rr�existingr��existing_col�conflicts_onr�rns          @rcrZzColumn._set_parent
	s�������%��'�'�'��y�y��#�#�E��
�
	
� � �"��8�8���y�y�D�H��4��$�/����H�E�$9��#�#�!�$�(�(��,&�&.�&:�&:�%;�1�>��
�
�������8�8�u�~�~�%� �>�>�$�(�(�3�L��x�x�4�9�9�$�%��$��
�Y�Y�)�
#�$�T�Y�Y�/�L�(�>�L�!�L��#��4�'�)��2�2�(���7�(4��(=�D�H�H�4�9�9��8�8=�
�
�|�2�	G���'�3�3�B��&�&�-�-�b�1��}�}��(9�(9�9��)�)�0�0����?�
4��L�4����T�Y�Y�9N��I�I�2�<�3C�3C�2D�E'�'+�y�y�k�2�$�(�(�)�*,�,�
�	�����t�,��?�#�	�$�)�)����
�� � ��z�z�*�*�6��'�'�H���+/�D�J�J�'�������&�&�t�,�
�X�X��*�*�
*��#�#�9�$�(�(��D4�49�N�N�3C�1�F��
�
�:�:��$�*�*�c�*��'�'�C���

�#�#���$�(�(�4����+<�4��
��[�[��$�+�+�s�+��'�'�:���
�#�#� �����=�
�	
�#�#�$J�K��=�=��t�|�|�X�.��$�-�-��2��#�#�F��
�3�rbc�l�|jj|jfdf|jj|jfdfg}|D]g\}}||jjjvs�)|jjj|D]}|j
|us�||���iy)NFT)rnrorfr��	_fk_memos�link_to_name)r�r��fk_keys�fk_keyr�r�s      rcr�zColumn._setup_on_memoized_fks�	s����j�j�n�n�d�h�h�
'��/��j�j�n�n�d�i�i�
(�$�/�
��%,� �F�L�����,�,�6�6�6��*�*�-�-�7�7��?�B����,�6��2��@�%,rbc�r�|j�|||j�ytj|d|�y)Nr�)rnr1r�)r�r�s  rc�_on_table_attachzColumn._on_table_attach�	s+���:�:�!��t�T�Z�Z� ��L�L��4�b�9rbr�z]The :meth:`_schema.Column.copy` method is deprecated and will be removed in a future release.c�&�|jdi|��S�Nra�rt�r�rrs  rcr�zColumn.copy�	����t�z�z��B��rbc	��|jD�cgc]!}|jr�|jdi|����#c}|jD�cgc]!}|jr�|jdi|����#c}z}i}|j
D]>}|j
|j}|j�D]\}}|||dz|z<��@|j}	|j}
t|	ttf�r%|j|	jdi|���dx}	}
|j}t|t�r|j di|��}|j"|id|j$�d|�d|j&�d|j(�d|j*�d|j,�d	|j.�d
|j0�d|j2�d|	�d
|j4�d|
�d|j6�d|j8�d|j:�d|j<�|��}|j>|_|j@|_ |jC|�Scc}wcc}w)z�Create a copy of this ``Column``, uninitialized.

        This is used in :meth:`_schema.Table.to_metadata` and by the ORM.

        �_Nrfr�ror�rpr�r�r�r~r'r�r�r�r�r�r�ra)"r�rwrtr�r�dialect_options�
_non_defaults�itemsr'r�rl�Computed�Identityrsr�r&r��_constructorrfror�rpr�r�r�r~r�r�r�r�r�r(r�r�)r�rrrpr��
column_kwargs�dialect_namer��dialect_option_key�dialect_option_valuer'r�r�s            rcrtzColumn._copy�	sm��$(�#3�#3�"
�#3�a�1�=�=�G�A�G�G�M�b�M�#3�"
�$(�$5�$5�J�$5�q�Q�\�\�W�Q�W�W�]�r�]�$5�J�"K��
�
� �0�0�L�"�2�2�<�@�N�N�O�!�&�&�(��"�$�)��l�S�0�3E�E�F�)�1��,�,���.�.���n�x��&:�;�
�K�K�,��,�,�2�r�2�3�/3�3�N�_��	�	���e�.�/��E�J�J�$��$�E�
�D���$�%
����
��
����
��(�(�	
�
�;�;�
��;�;�

��*�*�
��,�,�
��L�L�
�*�
��]�]�
�,�
����
��L�L�
� #'�"<�"<�!
�"!�1�1��'
��0�]�]��
�#'�#>�#>�� ��%�%�a�(�(��y"
��Js�H7�H7�H<�H<c��|jrd|_|jdk7r |jdk(r|j|_|jr|j|_|jr%|jj	|j�|j
}|js�|j
jr�t|t�r|j�}||_t|t�r|j|�|jj�D]$}t|t�s�|j|��&|jtur4|jtur"|j|_|j|_
|j �7|j �+|j j#�}|j%|�|j&rQ|j&�E|j&}t|t(�r"|j#�}|j%|�n||_|j*r9|j*�-|j*}|j#�}|j%|�|j,r7|j,�+|j,j#�}|j%|�|j.dvr|j.�|j.|_|j0dvr|j0�|j0|_|j2r|j2�|j2|_|j4r|j4�|j4|_|j6D]0}|j8r�|j#�}	|	j%|��2|j:D]0}
|
j<r�|
j#�}|j%|��2y)z�merge the elements of another column into this one.

        this is used by ORM pep-593 merge and will likely need a lot
        of fixes.


        Tr�N)TF)r�r�r�r��updater�r�rlr&r�r�r�r�r�r`r(r~rtrZr'rWr�r�r�rpr�r�r�rwr�r)r��otherr�r��new_default�new_server_default�new_server_onupdate�new_onupdater}�	new_constr��new_fks            rc�_mergez
Column._merge�	s������ $�E������'�E�,?�,?�6�,I�"&�"4�"4�E���;�;��;�;�E�L��9�9��J�J���d�i�i�(��	�	���}�}����!3�!3��%�!2�3��
�
����E�J��%�!2�3��/�/��6��.�.�5�5�7���d�$5�6��2�2�5�9�8�

�'�'�/?�?��,�,�0@�@�!�]�]�E�N�+/�+F�+F�E�(��<�<�#��
�
�(=��,�,�,�,�.�K��#�#�E�*����5�#7�#7�#?�!%�!4�!4���,�l�;�%7�%=�%=�%?�"�"�.�.�u�5�'9��$����E�$9�$9�$A�"&�"6�"6��"5�";�";�"=���+�+�E�2��=�=�U�^�^�3��=�=�.�.�0�L��$�$�U�+��:�:��&�5�;�;�+>��*�*�E�K��;�;�-�'�E�L�L�,@��;�;�E�L��8�8��	�	�)����E�I��<�<�E�M�M�1� �L�L�E�M��%�%�E��$�$�!�K�K�M�	��%�%�e�,�&�
�#�#�B��=�=�������"�"�5�)�$rbc	���|jD�	cgc]}	|	|	jd��f��c}	D�
�cgc]-\}
}t|�|n|
j|du|
j����/}	}
}|�!|j
�t
jd��	|j|r2tjtj|r|n|j
�n|xs|j
|jg|	��|r|n|r|n|j|j|j |rt#|�n|gd��}||_|j*|_|j,�4|j,j.j1|j�|_|jr|j3|�|	r|j5|	�|j|fScc}	wcc}}
w#t$$r}
t%d|j&z�|
�d}
~
wwxYw)a$Create a *proxy* for this column.

        This is a copy of this ``Column`` referenced by a different parent
        (such as an alias or select statement).  The column should
        be used only in select scenarios, as its full DDL/default
        information is not transferred.

        F��raiseerrN)�
_unresolvable�_constraintz^Cannot initialize a sub-selectable with this Column object until its 'name' has been assigned.)ror�r(r�z�Could not create a copy of this %r object.  Ensure the class includes a _constructor() attribute or method which accepts the standard Column constructor arguments, or references the Column class itself.)r��_resolve_column�
ForeignKey�_colspecrrfr2r�r�r�expectr�TruncatedLabelRoler�ror�r(r�r�r�rn�_propagate_attrs�_is_clone_ofr�r�rKr)r��
selectabler�r�rfro�name_is_truncatable�compound_select_colsrrr��fr|rpr�s              rc�_make_proxyzColumn._make_proxy;
s���<�+�+��+�B��R�'�'��'�7�8�+��

����3�
����A�J�J�!�T�k��L�L�
�
�
	�

��<�D�I�I�-��)�)�!��
�
	�!��!�!�
+��$�$��0�0�$�$�D�I�I���+�$�)�)��	�	��$�%��C�D�D�d�h�h� �,�,����,��-�.���!�A�:���'�8�8����"�"�.�'�4�4�<�<�@�@����G�A�N�����O�O�A��
�����#��u�u�a�x���k��

��N�	��6�9=���	G���

��	�s#�F9�2F>�	BG�	G+�
G&�&G+�NN)2r�z@Optional[Union[str, _TypeEngineArgument[_T], SchemaEventTarget]]r�z;Optional[Union[_TypeEngineArgument[_T], SchemaEventTarget]]r�r&rfr�r��!Optional[_TypeEngineArgument[_T]]r�r<r~r�r�r�r�r�ror�r�r�rpr�r��Optional[_InfoType]r(z<Optional[Union[bool, Literal[SchemaConst.NULL_UNSPECIFIED]]]r�r�r�r�r'z Optional[_ServerDefaultArgument]r�z!Optional[_ServerOnUpdateArgument]r�r�r�r�r�r�r�r�r�r�r�r�r�r)r�zTypeEngine[Any]rvr�)rvr�rvr�r�r�)rP�Column[Any]rvr��r�rrvr�)
rYr&r�zDict[str, Column[Any]]r�r�rrrrvr�)r��Callable[..., Any]rvr�)rrrrvr)rrrvr�)NNFN)rrPr�rAr�zSet[KeyedColumnElement[Any]]rfr�ror�rr�rz.Optional[_typing_Sequence[ColumnElement[Any]]]rrrrvzTuple[str, ColumnClause[_T]])"r[r\r]r�r��
inherit_cacher�rr�rYr`r�r�r5�memoized_attributer�r�r4r�r�r�rIr�r�r�rZr�r�r�r�rtrrr�r�s@rcrmrm�s:���2��N��M�	�H�*�*�
�
�\
-�#�37�,2�!'���(.�
�
�!�!� $�!%�$(�
�(�(�"&�!�;?�=A� $��!%� %�&+�"&�?\
-�
�\
-�

�\
-�!�\
-��\
-�1�\
-�*�\
-��\
-�&�\
-��\
-��\
-� �!\
-�"�#\
-�$"�%\
-�&
�'\
-�, �-\
-�.�/\
-�09�1\
-�2;�3\
-�4�5\
-�6�7\
-�8�9\
-�:�;\
-�< $�=\
-�> �?\
-�@�A\
-�|�L� � �!�!�
����
���!� � � �5��#�#�K�$�K�
�#�#�L�$�L�
���?��?�.�	$��+�
�>{�!�{�*�	{�
!�{��
{�
�{�z	�:��T�_�_�
�	3��
 ��
 �D)�LS*�t#�!�$)�
�Q��Q��Q�3�	Q�
�Q��
Q�"�Q�
�Q��Q�
&�QrbrmT)r~�omit_from_statementsc�^�t||�tjn||�|n	t�|d��S)a�Provides a surrogate :class:`_schema.Column` that will act as a
    dedicated insert :term:`sentinel` column, allowing efficient bulk
    inserts with deterministic RETURNING sorting for tables that
    don't otherwise have qualifying primary key configurations.

    Adding this column to a :class:`.Table` object requires that a
    corresponding database table actually has this column present, so if adding
    it to an existing model, existing database tables would need to be migrated
    (e.g. using ALTER TABLE or similar) to include this column.

    For background on how this object is used, see the section
    :ref:`engine_insertmanyvalues_sentinel_columns` as part of the
    section :ref:`engine_insertmanyvalues`.

    The :class:`_schema.Column` returned will be a nullable integer column by
    default and make use of a sentinel-specific default generator used only in
    "insertmanyvalues" operations.

    .. seealso::

        :func:`_orm.orm_insert_sentinel`

        :paramref:`_schema.Column.insert_sentinel`

        :ref:`engine_insertmanyvalues`

        :ref:`engine_insertmanyvalues_sentinel_columns`


    .. versionadded:: 2.0.10

    T)rfr�r~r�r�)rmr�INTEGERTYPE�_InsertSentinelColumnDefault)rfr�r~r#s    rcr�r��
s8��N�
�&+�m�h�"�"���*�G�0L�0N�2���rbc��eZdZUdZdZded<ded<												d#																											d$d�Zd%d	�Zejd
d�dd�d&d
��Z
dd�d&d�Z			d'							d(d�Ze
d)d��Zd*d�Ze
e�Zd+d�Zd,d�Zej&d-d��Zd.d�Z								d/d�Zd0d�Zej0d1d��Zedd�			d2d��Zedd�			d3d��Zdd�			d3d�Zd4d�Zd5d �Zd6d!�Zd7d"�Zy)8raUDefines a dependency between two columns.

    ``ForeignKey`` is specified as an argument to a :class:`_schema.Column`
    object,
    e.g.::

        t = Table(
            "remote_table",
            metadata,
            Column("remote_id", ForeignKey("main_table.id")),
        )

    Note that ``ForeignKey`` is only a marker object that defines
    a dependency between two columns.   The actual constraint
    is in all cases represented by the :class:`_schema.ForeignKeyConstraint`
    object.   This object will be generated automatically when
    a ``ForeignKey`` is associated with a :class:`_schema.Column` which
    in turn is associated with a :class:`_schema.Table`.   Conversely,
    when :class:`_schema.ForeignKeyConstraint` is applied to a
    :class:`_schema.Table`,
    ``ForeignKey`` markers are automatically generated to be
    present on each associated :class:`_schema.Column`, which are also
    associated with the constraint object.

    Note that you cannot define a "composite" foreign key constraint,
    that is a constraint between a grouping of multiple parent/child
    columns, using ``ForeignKey`` objects.   To define this grouping,
    the :class:`_schema.ForeignKeyConstraint` object must be used, and applied
    to the :class:`_schema.Table`.   The associated ``ForeignKey`` objects
    are created automatically.

    The ``ForeignKey`` objects associated with an individual
    :class:`_schema.Column`
    object are available in the `foreign_keys` collection
    of that column.

    Further examples of foreign key configuration are in
    :ref:`metadata_foreignkeys`.

    �foreign_keyrrYr��
_table_columnNc�:�tjtj|�|_|
|_t
|jt�rd|_nl|j|_t
|jjtd�tf�s,tjd|jjz��||_d|_||_||_||_||_||_||_|	|_|
|_||_|r||_||_y)a�
        Construct a column-level FOREIGN KEY.

        The :class:`_schema.ForeignKey` object when constructed generates a
        :class:`_schema.ForeignKeyConstraint`
        which is associated with the parent
        :class:`_schema.Table` object's collection of constraints.

        :param column: A single target column for the key relationship. A
            :class:`_schema.Column` object or a column name as a string:
            ``tablename.columnkey`` or ``schema.tablename.columnkey``.
            ``columnkey`` is the ``key`` which has been assigned to the column
            (defaults to the column name itself), unless ``link_to_name`` is
            ``True`` in which case the rendered name of the column is used.

        :param name: Optional string. An in-database name for the key if
            `constraint` is not provided.

        :param onupdate: Optional string. If set, emit ON UPDATE <value> when
            issuing DDL for this constraint. Typical values include CASCADE,
            DELETE and RESTRICT.

        :param ondelete: Optional string. If set, emit ON DELETE <value> when
            issuing DDL for this constraint. Typical values include CASCADE,
            SET NULL and RESTRICT.

        :param deferrable: Optional bool. If set, emit DEFERRABLE or NOT
            DEFERRABLE when issuing DDL for this constraint.

        :param initially: Optional string. If set, emit INITIALLY <value> when
            issuing DDL for this constraint.

        :param link_to_name: if True, the string name given in ``column`` is
            the rendered name of the referenced column, not its locally
            assigned ``key``.

        :param use_alter: passed to the underlying
            :class:`_schema.ForeignKeyConstraint`
            to indicate the constraint should
            be generated/dropped externally from the CREATE TABLE/ DROP TABLE
            statement.  See :paramref:`_schema.ForeignKeyConstraint.use_alter`
            for further description.

            .. seealso::

                :paramref:`_schema.ForeignKeyConstraint.use_alter`

                :ref:`use_alter`

        :param match: Optional string. If set, emit MATCH <value> when issuing
            DDL for this constraint. Typical values include SIMPLE, PARTIAL
            and FULL.

        :param info: Optional data dictionary which will be populated into the
            :attr:`.SchemaItem.info` attribute of this object.

        :param comment: Optional string that will render an SQL comment on
          foreign key constraint creation.

            .. versionadded:: 2.0

        :param \**dialect_kw:  Additional keyword arguments are dialect
            specific, and passed in the form ``<dialectname>_<argname>``.  The
            arguments are ultimately handled by a corresponding
            :class:`_schema.ForeignKeyConstraint`.
            See the documentation regarding
            an individual dialect at :ref:`dialect_toplevel` for detail on
            documented arguments.

        Nz8ForeignKey received Column not bound to a Table, got: %r)rrr�DDLReferredColumnRolerrrlr�r)rnr�r-r2r�rrY�	use_alterrfr��ondelete�
deferrable�	initiallyr��matchr�r��_unvalidated_dialect_kw)r�rPr
r,rfr�r-r.r/r�r0r�r�r�
dialect_kws               rcr�zForeignKey.__init__�
s���p"�(�(��)D�)D�f�M��
�*����d�m�m�S�)�!%�D��!%���D����"�"�(�(�4��:�{�*C���'�'�*�,0�,>�,>�,D�,D�E���&������"�����	� ��
� ��
�$���"���(�����
������D�I�'1��$rbc�(�d|j�zS)NzForeignKey(%r))�_get_colspecr�s rcr�zForeignKey.__repr__ps���$�"3�"3�"5�5�5rbr�zaThe :meth:`_schema.ForeignKey.copy` method is deprecated and will be removed in a future release.r@c�*�|jdd|i|��S)Nrgrar�)r�rgrrs   rcr�zForeignKey.copyss���t�z�z�.��.�2�.�.rbc
�8�t|j|��f|j|j|j|j
|j|j|j|j|jd�	|j��}|j|�S)aProduce a copy of this :class:`_schema.ForeignKey` object.

        The new :class:`_schema.ForeignKey` will not be bound
        to any :class:`_schema.Column`.

        This method is usually used by the internal
        copy procedures of :class:`_schema.Column`, :class:`_schema.Table`,
        and :class:`_schema.MetaData`.

        :param schema: The returned :class:`_schema.ForeignKey` will
          reference the original table and column name, qualified
          by the given string schema name.

        r@)	r,rfr�r-r.r/r�r0r�)
rr4r,rfr�r-r.r/r�r0r�r1r�)r�rgrrr�s    rcrtzForeignKey._copy{s�������V��,�
��n�n�����]�]��]�]�����n�n��*�*��*�*��L�L�
��*�*�
���%�%�b�)�)rbc�4�|dtfvr-|j\}}}|�|}|tur|�d|��S|�d|�d|��S|r#|j\}}}|r
|�d|�d|��S|�d|��S|j��|jj�:|r"tjd|j����|jjS|jjj�d|jj��St|jt�sJ�|jS)z�Return a string based 'column specification' for this
        :class:`_schema.ForeignKey`.

        This is usually the equivalent of the string-based "tablename.colname"
        argument first passed to the object's constructor.

        NrezDCan't copy ForeignKey object which refers to non-table bound Column )r^�_column_tokensr_r)rnr2r�ror�rlrr�)r�rg�
table_name�_is_copy�_schema�tname�colnames       rcr4zForeignKey._get_colspec�s+��$�$�
�.�.�&*�&9�&9�#�G�U�G��%�"����%�"'��1�1�%+�U�G�<�<�
�%)�%8�%8�"�F�E�7��%+�Z��A�A�",�g�6�6�
�
�
�
+��!�!�'�'�/���1�1�2�26�2D�2D�1G�I���
 �-�-�1�1�1��"�"�(�(�1�1��"�"�&�&��
�
�d�m�m�S�1�1�1��=�=� rbc� �|jdS�Nr)r8r�s rcrvzForeignKey._referred_schema�s���"�"�1�%�%rbc��|j�7|jj�y|jjjS|j\}}}t	||�Srk)r)rnror8rh)r�rgr<r=s    rc�
_table_keyzForeignKey._table_key�sZ�����)��!�!�'�'�/���)�)�/�/�3�3�3�%)�%8�%8�"�F�E�7�!�%��0�0rbc�<�|j|j�duS)zrReturn True if the given :class:`_schema.Table`
        is referenced by this
        :class:`_schema.ForeignKey`.N)�corresponding_columnrPrLs  rcr�zForeignKey.references�s��
�)�)�$�+�+�6�d�B�Brbc�L�|jj|j�S)a-Return the :class:`_schema.Column` in the given
        :class:`_schema.Table` (or any :class:`.FromClause`)
        referenced by this :class:`_schema.ForeignKey`.

        Returns None if this :class:`_schema.ForeignKey`
        does not reference the given
        :class:`_schema.Table`.

        )r�rCrPrLs  rc�get_referentzForeignKey.get_referent�s���}�}�1�1�$�+�+�>�>rbc�X�|j�jd�}|�"tjd|j����t|�dk(r|j
�}d}n |j
�}|j
�}t|�dkDrdj|�}nd}|||fS)z7parse a string-based _colspec into its component parts.reNz*Invalid foreign key column specification: rr)r4�splitr2r�r�lenr�rB)r��mr<r=rgs     rcr8zForeignKey._column_tokens�s���
����%�%�c�*���9��#�#�<�T�]�]�O�L��
��q�6�Q�;��E�E�G�E��G��e�e�g�G��E�E�G�E��q�6�A�:��X�X�a�[�F��F��u�g�%�%rbc�<�|j�tjd��|jj�tjd��|jj}|jr!|j
\}}}t
||�}|||fS|jjD]$}t|t�s�|j|usJ�nJ�|j
\}}}|�,|jj�|jj}t
||�}|||fS)NzLthis ForeignKey object does not yet have a parent Column associated with it.zCthis ForeignKey's parent column is not yet associated with a Table.)rYr2r�rnrr8rh�base_columnsrlrmr�rg)r��parenttablergr<r=�tablekeyrps       rc�_resolve_col_tokenszForeignKey._resolve_col_tokenss#���;�;���)�)�4��
�
�[�[�
�
�
&��)�)� ��
�
�k�k�'�'�����%)�%8�%8�"�F�E�7�%�e�V�4�H���'�1�1����)�)�A��!�V�$��w�w�+�-�-�-��*�

�5�"&�!4�!4����w��>�k�2�2�9�9�E� �)�)�0�0�F�!�%��0���H�g�-�-rbc��d}|�9|j}|�J�|j}|jj|d�}nP|jr&|}|jD]}|j
|k(s�|}�n|}|jj|d�}|�Lt
jd|j�d|j
�d|j
�d|�d�	|j
|��|S)Nz3Could not initialize target column for ForeignKey 'z' on table 'z
': table 'z' has no column named 'r)	rYrorpr�r�rfr2�NoReferencedColumnErrorr)r�rLrnr=�_columnrYrorps        rc�_link_to_col_by_colstringz$ForeignKey._link_to_col_by_colstring7s������?��[�[�F��%�%�%��*�*�C��g�g�k�k�#�t�,�G�
�
�
��C��W�W���6�6�W�$��G���C��g�g�k�k�'�4�0�G��?��-�-�#�#'�=�=�/�2�(�-�-�.�/��*�*��%<�S�E��D��
�
��
�
��rbc����|j�J�|jjjr�j|j_d�fd�}|jj|��|_y)Nc�~��|jjjr�j|j_yyrk)rYr�r�)r�rPs �rc�set_typez/ForeignKey._set_target_column.<locals>.set_typees(����y�y�~�~�%�%�!'����	�	��&rbr)rYr�r�r�rP)r�rPrUs ` rc�_set_target_columnzForeignKey._set_target_column[sX����{�{�&�&�&��;�;���#�#�%�{�{�D�K�K��
	-�	
���*�*�8�4���rbc�"�|j�S)z�Return the target :class:`_schema.Column` referenced by this
        :class:`_schema.ForeignKey`.

        If no target column has been established, an exception
        is raised.

        )rr�s rcrPzForeignKey.columnms���#�#�%�%rb.r
c��yrkra�r�rs  rcrzForeignKey._resolve_columnys��rbc��yrkrarYs  rcrzForeignKey._resolve_column~���!$rbTc	�,�t|jt�r�|j�\}}}|js||j
vr-|syt
jd|j�d|�d|�d�|��|j|j
vr|syt
jd|�d���|j
j|}|j|||�St|jd�r|jj�}|S|j}|S)Nz$Foreign key associated with column 'z' could not find table 'z9' with which to generate a foreign key to target column 'rzTable z1 is no longer associated with its parent MetaData�__clause_element__)rlrr�rNrr�r2�NoReferencedTableErrorrYror�r�rRr�r])r�rrLrMr=rnrQs       rcrzForeignKey._resolve_column�s+��
�d�m�m�S�)�-1�-E�-E�-G�*�K��7��!�!�X�[�5I�5I�%I����0�0�����}�%�&�Z�(5�5<�I�Q�@��������(<�(<�<����-�-��[�M�*&�&���
$�,�,�3�3�H�=���5�5�������T�]�]�$8�
9��m�m�6�6�8�G��N��m�m�G��Nrbc�(�t|t�sJ�|j�#|j|urtjd��||_|jj
j
|�|jj|j�y)Nz&This ForeignKey already has a parent !)	rlrmrYr2r�r�rKr��
_set_table�r�rYrrs   rcrZzForeignKey._set_parent�st���&�&�)�)�)��;�;�"�t�{�{�&�'@��)�)�8��
������� � �$�$�T�*����$�$�T�_�_�5rbc���|j�\}}}|j|||�}|j|�|j�J�|jj	|�yrk)rNrRrVr�_validate_dest_table)r�rnrLr�r=rQs      rcr�zForeignKey._set_remote_table�s[��"&�":�":�"<���Q���0�0��e�W�M������(����*�*�*����,�,�U�3rbc��|j�\}}}||f}||j|vr|j|j|�yyrk)rNr�r)r�r�rL�	table_keyr=r�s      rc�_remove_from_metadataz ForeignKey._remove_from_metadata�sR��*.�*B�*B�*D�'��Y���W�%���8�%�%�f�-�-����v�&�-�-�d�3�.rbc� �t|t�sJ�|j��tggf|j|j
|j|j|j|j|j|jd�|j��|_|jj||�|jj|�|jj!|�t|j"t$�r�|j'�\}}}||f}||j(j*vr>|j(j*|}	|j-|||�}|j/|�|j(j4|j7|�yt9|j"d�r,|j"j;�}|j/|�y|j"}|j/|�y#t0j2$rY��wxYw)N)r,rfr�r-r.r/r0r�r])rlrVrrur,rfr�r-r.r/r0r�r1�_append_elementr�r�rKrr�rNr�r�rRrVr2rPr�rsr�r])r�rPrnrLrer=r�rQs        rcr`zForeignKey._set_table�s����%��'�'�'��?�?�"�2�����.�.��Y�Y��������?�?��.�.��j�j������.�.��D�O�
�O�O�+�+�F�D�9��O�O�5�5�e�<�
�����t�$��d�m�m�S�)�.2�.F�.F�.H�+�K��G���)�F��K�0�0�7�7�7�#�,�,�3�3�I�>��5�"�<�<�#�U�G��G��+�+�G�4�� � �*�*�6�2�9�9�$�?�
�T�]�]�$8�
9��m�m�6�6�8�G��#�#�G�,��m�m�G��#�#�G�,���2�2����s�
G7�7H
�H
)NFNNNNNFNNNF)rPr=r
zOptional[ForeignKeyConstraint]r,r�rf�_ConstraintNameArgumentr�r�r-r�r.r�r/r�r�r�r0r�r�rr�r�rr�r2rr�)rgr�rrrrvr)NNF)rgzROptional[Union[str, Literal[SchemaConst.RETAIN_SCHEMA, SchemaConst.BLANK_SCHEMA]]]r9r�r:r�rvr��rvr�)rvr)rnrVrvr�)rnrPrvr�)rvz(Tuple[Optional[str], str, Optional[str]])rvz Tuple[Table, str, Optional[str]])rLrVrnrVr=r�rvr)rPrrvr�)rvr)rz
Literal[True]rvr)rr�rvr�r�r��r�rXrvr��rPrrnrVrvr�) r[r\r]r�r�r�r�r�r4r�r�rtr4r�rvrA�target_fullnamer�rEr�r8rNrRrVr�rPrrrZr�rfr`rarbrcrr�
sg��'�R#�N���(�(�
7;��(,�"&�"&�%)�#'�"�#�$(�!%�#�}2�"�}2�4�}2��	}2�
&�}2� �
}2� �}2�#�}2�!�}2��}2��}2�"�}2��}2��}2��}2�~6��T�_�_�
�	3��
/3�/��
/�04�*�J
�$(��/!�
�/!�"�/!��/!�

�/!�b�&��&�1��|�,�O�C�
?�
���&��&�<&.�P"� �"�).�"�9F�"�	�"�H�$
���	&��	&��+.��(��	�����"%�$��$�	�$��$�
#'�$��$�	�$�L	6�4�4�,-rbrc��yrkra��objs rcr,r,�s��!rbc��yrkraros rc�default_is_clause_elementrr����03rbc��yrkraros rc�default_is_scalarru�rsrb�is_sequence�is_clause_element�	is_scalarc��eZdZUdZdZdZdZdZdZdZ	dZ
dZdZdZ
ded<d
dd�Zdd�Zdd	�Z								dd
�Z								dd�Zy)�DefaultGeneratorz�Base class for column *default* values.

    This object is only present on column.default or column.onupdate.
    It's not valid as a server default.

    �default_generatorTFr�rPc��||_yrkr��r�r�s  rcr�zDefaultGenerator.__init__
�	��$��rbc��trt|t�sJ�||_|jr||j_y||j_yrk)rrlrmrPr�r�r~ras   rcrZzDefaultGenerator._set_parent 
s;����f�f�-�-�-�����?�?�#'�D�K�K� �"&�D�K�K�rbc��t��rk��NotImplementedErrorr�s rcrtzDefaultGenerator._copy)
���!�#�#rbc�T�tjdd�|j|||�S)NzoUsing the .execute() method to invoke a DefaultGenerator object is deprecated; please use the .scalar() method.z2.0)r4�warn_deprecated�_execute_on_scalar�r��
connection�distilled_params�execution_optionss    rc�_execute_on_connectionz'DefaultGenerator._execute_on_connection,
s:��	
���
$�
�		
��&�&��(�*;�
�	
rbc�(�|j|||�Srk)�_execute_defaultr�s    rcr�z#DefaultGenerator._execute_on_scalar<
s ���*�*��"�$5�
�	
rbNr��r�r�rvr�r�)rvrz)r�rIr�rKr�rLrvr)r[r\r]r�r��_is_default_generatorrv�is_identity�is_server_defaultrwr.rx�has_argr*r�r�rZrtr�r�rarbrcrzrz
s����)�N� ���K��K������K��I��G��K�!�!�%�'�$�
��
�2�
�7�	
�


�
� 
��
�2�
�7�	
�


�
rbrzc��eZdZUdZded<e	d
					dd��Ze	d
					dd��Zed
d
d��Z	d					dd�Zdd	�Zy)r�a�A plain default value on a column.

    This could correspond to a constant, a callable function,
    or a SQL clause.

    :class:`.ColumnDefault` is generated automatically
    whenever the ``default``, ``onupdate`` arguments of
    :class:`_schema.Column` are used.  A :class:`.ColumnDefault`
    can be passed positionally as well.

    For example, the following::

        Column("foo", Integer, default=50)

    Is equivalent to::

        Column("foo", Integer, ColumnDefault(50))

    r�argc��yrkra�r�r�r�s   rcr�zColumnDefault.__new__^
r[rbc��yrkrar�s   rcr�zColumnDefault.__new__c
s��&)rbc��yrkrar�s   rcr�zColumnDefault.__new__k
s��LOrbNc���t|t�rtjd��t	|�rt
}nt|t�rt}n|�t}tj|�S)a{Construct a new :class:`.ColumnDefault`.


        :param arg: argument representing the default value.
         May be one of the following:

         * a plain non-callable Python value, such as a
           string, integer, boolean, or other simple type.
           The default value will be used as is each time.
         * a SQL expression, that is one which derives from
           :class:`_expression.ColumnElement`.  The SQL expression will
           be rendered into the INSERT or UPDATE statement,
           or in the case of a primary key column when
           RETURNING is not used may be
           pre-executed before an INSERT within a SELECT.
         * A Python callable.  The function will be invoked for each
           new row subject to an INSERT or UPDATE.
           The callable must accept exactly
           zero or one positional arguments.  The one-argument form
           will receive an instance of the :class:`.ExecutionContext`,
           which provides contextual information as to the current
           :class:`_engine.Connection` in use as well as the current
           statement and parameters.

        z4ColumnDefault may not be a server-side default type.)rlrWr2r��callable�CallableColumnDefaultr(�ColumnElementColumnDefault�ScalarElementColumnDefaultr�r�r�s   rcr�zColumnDefault.__new__n
sZ��:�c�<�(��#�#�F��
��c�]�'�C�
��]�
+�,�C�
�_�,�C��~�~�c�"�"rbc�N�|jj�d|j�d�S)N�(�))r�r[r�r�s rcr�zColumnDefault.__repr__�
s$���.�.�)�)�*�!�D�H�H�<�q�9�9rb).)r�r r�r�rvr�)r��ColumnElement[Any]r�r�rvr�)r�r�r�r�rvr�)NF)r�rr�r�rvr�r�)r[r\r]r�r�rr�r�rarbrcr�r�G
s����(

�H�
�9<�$�$�$�26�$�	�$��$��9<�)�$�)�26�)�	#�)��)��O��O�27�(#��(#�*.�(#�	�(#�T:rbr�c�*�eZdZdZdZdZddd�Zdd�Zy)	r�zQdefault generator for a fixed scalar Python value

    .. versionadded: 2.0

    Tc� �||_||_yrk�r�r��r�r�r�s   rcr�z#ScalarElementColumnDefault.__init__�
s��$�����rbc�D�t|j|j��S�N�r�r�)r�r�r�r�s rcrtz ScalarElementColumnDefault._copy�
���)����T�_�_�
�	
rbNr�)r�rr�r�rvr�)rvr�)r[r\r]r�rxr�r�rtrarbrcr�r��
s����I��G��
rbr�c�H��eZdZdZdZdZdZd	d�Zd
d�Zd�fd�Z	d	d�Z
�xZS)r&z�Default generator that's specific to the use of a "sentinel" column
    when using the insertmanyvalues feature.

    This default is used as part of the :func:`_schema.insert_sentinel`
    construct.

    TFNc�,�tj|�Srk)r�r�)r�s rcr�z$_InsertSentinelColumnDefault.__new__�
s���~�~�c�"�"rbc��yrkrar�s rcr�z%_InsertSentinelColumnDefault.__init__�
rrbc����td|�}|jstjd��|jstjd��t�|�|fi|��y)Nrz_The _InsertSentinelColumnDefault may only be applied to a Column marked as insert_sentinel=TruezQThe _InsertSentinelColumnDefault may only be applied to a Column that is nullable)rr�r2r�r(r�rZ)r�rYrrr|r�s    �rcrZz(_InsertSentinelColumnDefault._set_parent�
se����=�&�)���#�#��#�#�8��
�����#�#�*��
�
	���F�)�b�)rbc��t�Srk)r&r�s rcrtz"_InsertSentinelColumnDefault._copy�
s��+�-�-rb)rvr&r�r�)r[r\r]r�r*r�r�r�r�rZrtr�r�s@rcr&r&�
s-�����K��J�
�C�#�
�
*�.rbr&)r�r,c��eZdZUdZdZdZded<	d
					dd�Zdd�Ze	je	jd�d
d���Zy	)r�zGdefault generator for a SQL expression

    .. versionadded:: 2.0

    T�_SQLExprDefaultr�c� �||_||_yrkr�r�s   rcr�z#ColumnElementColumnDefault.__init__�
s��
%�����rbc�D�t|j|j��Sr�)r�r�r�r�s rcrtz ColumnElementColumnDefault._copy�
r�rbzsqlalchemy.sql.sqltypesc��tjj}t|jj
|j�Srk)r4�	preloaded�sql_sqltypesrlr�r��NullType)r��sqltypess  rc�
_arg_is_typedz(ColumnElementColumnDefault._arg_is_typed�
s1���>�>�.�.���d�h�h�m�m�X�->�->�?�?�?rbNr�)r�r�r�r�rvr�)rvr�r)
r[r\r]r�rwr�r�r�rtr4r��preload_moduler�rarbrcr�r��
sw������G�	��
!��
����
�	�
�

����T���2�3�@�4��@rbr�c��eZdZdd�Zy)�_CallableColumnDefaultProtocolc��yrkra)r��contexts  rc�__call__z'_CallableColumnDefaultProtocol.__call__�
s��#rbN)r�rMrvr)r[r\r]r�rarbrcr�r��
s��=rbr�c�R�eZdZUdZdZded<dZ	d						d
d�Zdd�Z				dd�Z	y)
r�zQdefault generator for a callable Python function

    .. versionadded:: 2.0

    Tr�r�c�>�||_|j|�|_yrk)r��_maybe_wrap_callabler�r�s   rcr�zCallableColumnDefault.__init__s��
%����,�,�S�1��rbc�D�t|j|j��Sr�)r�r�r�r�s rcrtzCallableColumnDefault._copys��$����d�o�o�N�Nrbc�P��	tj�d��}|dduxrt	|d�xsd}t	|d�|z
}|dk(rtj�fd���S|dk(r�Stjd	��#t$rtj�fd���cYSwxYw)
z�Wrap callables that don't accept a context.

        This is to allow easy compatibility with default callables
        that aren't specific to accepting of a context.

        T)�no_selfc�����Srkra��ctxr�s �rcr	z<CallableColumnDefault._maybe_wrap_callable.<locals>.<lambda> ����"�$rbrZNrc�����Srkrar�s �rcr	z<CallableColumnDefault._maybe_wrap_callable.<locals>.<lambda>&r�rbrzDColumnDefault Python function takes zero or one positional arguments)r4�get_callable_argspecr��
wrap_callablerHr2r�)r�r��argspec�	defaulted�positionalss `   rcr�z*CallableColumnDefault._maybe_wrap_callables����	<��/�/��D�A�G��A�J�d�*�>�s�7�1�:��C�!�	��'�!�*�o�	�1���!���%�%�&6��;�;�
�A�
��I��#�#�'��
���	<��%�%�&6��;�;�	<�s�B�"B%�$B%Nr�)r��8Union[_CallableColumnDefaultProtocol, Callable[[], Any]]r�r�rvr�)rvr�)r�r�rvr�)
r[r\r]r�r.r�r�r�rtr�rarbrcr�r��
sZ����K�	'�'��G�
!�2�
E�2��2�
�	2�O��J��	'�rbr�c�d�eZdZdZ									d																			dd�Zedd��Zy)�IdentityOptionsz�Defines options for a named database sequence or an identity column.

    .. versionadded:: 1.3.18

    .. seealso::

        :class:`.Sequence`

    Nc
��||_||_||_||_||_||_||_||_|	|_y)a\Construct a :class:`.IdentityOptions` object.

        See the :class:`.Sequence` documentation for a complete description
        of the parameters.

        :param start: the starting index of the sequence.
        :param increment: the increment value of the sequence.
        :param minvalue: the minimum value of the sequence.
        :param maxvalue: the maximum value of the sequence.
        :param nominvalue: no minimum value of the sequence.
        :param nomaxvalue: no maximum value of the sequence.
        :param cycle: allows the sequence to wrap around when the maxvalue
         or minvalue has been reached.
        :param cache: optional integer value; number of future values in the
         sequence which are calculated in advance.
        :param order: optional boolean value; if ``True``, renders the
         ORDER keyword.

        N�	�start�	increment�minvalue�maxvalue�
nominvalue�
nomaxvalue�cycle�cache�order)
r�r�r�r�r�r�r�r�r�r�s
          rcr�zIdentityOptions.__init__<sC��>��
�"��� ��
� ��
�$���$�����
���
���
rbc�@�|jduxr|jdkSr?)r�r�s rcr%z&IdentityOptions._increment_is_negativees���~�~�T�)�@�d�n�n�q�.@�@rb)	NNNNNNNNN)r��
Optional[int]r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rvr�r)r[r\r]r�r�r�r%rarbrcr�r�1s���� $�#'�"&�"&�%)�%)� $�#� $�'��'�!�'� �	'�
 �'�#�
'�#�'��'��'��'�
�'�R�A��Arbr�c���eZdZUdZdZdZded<ded<																d																																			dd�Zejd	�dd
��Z
d�fd�Zdd�Zdd
�Z
dd�Zddd�Zddd�Zdd�Z�xZS)racRepresents 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`,
    rendering the appropriate "next value" function
    for the target database and returning a result.

    The :class:`.Sequence` is typically associated with a primary key column::

        some_table = Table(
            "some_table",
            metadata,
            Column(
                "id",
                Integer,
                Sequence("some_table_seq", start=1),
                primary_key=True,
            ),
        )

    When CREATE TABLE is emitted for the above :class:`_schema.Table`, if the
    target platform supports sequences, a CREATE SEQUENCE statement will
    be emitted as well.   For platforms that don't support sequences,
    the :class:`.Sequence` construct is ignored.

    .. seealso::

        :ref:`defaults_sequences`

        :class:`.CreateSequence`

        :class:`.DropSequence`

    �sequenceTr�rPzOptional[TypeEngine[int]]�	data_typec���tj||��tj|||||||||
|��
d|_t	||�|_|
|_|	tur
dx|_}	n?|�"|	� |jr|jx|_}	nt	j|	|�|_||_
t||	�|_|r|j|�|�t|�|_yd|_y)a�Construct a :class:`.Sequence` object.

        :param name: the name of the sequence.

        :param start: the starting index of the sequence.  This value is
         used when the CREATE SEQUENCE command is emitted to the database
         as the value of the "START WITH" clause. If ``None``, the
         clause is omitted, which on most platforms indicates a starting
         value of 1.

         .. versionchanged:: 2.0 The :paramref:`.Sequence.start` parameter
            is required in order to have DDL emit "START WITH".  This is a
            reversal of a change made in version 1.4 which would implicitly
            render "START WITH 1" if the :paramref:`.Sequence.start` were
            not included.  See :ref:`change_7211` for more detail.

        :param increment: the increment value of the sequence.  This
         value is used when the CREATE SEQUENCE command is emitted to
         the database as the value of the "INCREMENT BY" clause.  If ``None``,
         the clause is omitted, which on most platforms indicates an
         increment of 1.
        :param minvalue: the minimum value of the sequence.  This
         value is used when the CREATE SEQUENCE command is emitted to
         the database as the value of the "MINVALUE" clause.  If ``None``,
         the clause is omitted, which on most platforms indicates a
         minvalue of 1 and -2^63-1 for ascending and descending sequences,
         respectively.

        :param maxvalue: the maximum value of the sequence.  This
         value is used when the CREATE SEQUENCE command is emitted to
         the database as the value of the "MAXVALUE" clause.  If ``None``,
         the clause is omitted, which on most platforms indicates a
         maxvalue of 2^63-1 and -1 for ascending and descending sequences,
         respectively.

        :param nominvalue: no minimum value of the sequence.  This
         value is used when the CREATE SEQUENCE command is emitted to
         the database as the value of the "NO MINVALUE" clause.  If ``None``,
         the clause is omitted, which on most platforms indicates a
         minvalue of 1 and -2^63-1 for ascending and descending sequences,
         respectively.

        :param nomaxvalue: no maximum value of the sequence.  This
         value is used when the CREATE SEQUENCE command is emitted to
         the database as the value of the "NO MAXVALUE" clause.  If ``None``,
         the clause is omitted, which on most platforms indicates a
         maxvalue of 2^63-1 and -1 for ascending and descending sequences,
         respectively.

        :param cycle: allows the sequence to wrap around when the maxvalue
         or minvalue has been reached by an ascending or descending sequence
         respectively.  This value is used when the CREATE SEQUENCE command
         is emitted to the database as the "CYCLE" clause.  If the limit is
         reached, the next number generated will be the minvalue or maxvalue,
         respectively.  If cycle=False (the default) any calls to nextval
         after the sequence has reached its maximum value will return an
         error.

        :param schema: optional schema name for the sequence, if located
         in a schema other than the default.  The rules for selecting the
         schema name when a :class:`_schema.MetaData`
         is also present are the same
         as that of :paramref:`_schema.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 Database and PostgreSQL.

        :param order: optional boolean value; if ``True``, renders the
         ORDER keyword, understood by Oracle Database, indicating the sequence
         is definitively ordered.   May be necessary to provide deterministic
         ordering using Oracle RAC.

        :param data_type: The type to be returned by the sequence, for
         dialects that allow us to choose between INTEGER, BIGINT, etc.
         (e.g., mssql).

         .. versionadded:: 1.4.0

        :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
         key identifiers.  Currently, it essentially means, "don't create
         this sequence on the PostgreSQL backend, where the SERIAL keyword
         creates a sequence for us automatically".
        :param quote: boolean value, when ``True`` or ``False``, explicitly
         forces quoting of the :paramref:`_schema.Sequence.name` on or off.
         When left at its default of ``None``, normal quoting rules based
         on casing and reserved words take place.
        :param quote_schema: Set the quoting preferences for the ``schema``
         name.

        :param metadata: optional :class:`_schema.MetaData` object which this
         :class:`.Sequence` will be associated with.  A :class:`.Sequence`
         that is associated with a :class:`_schema.MetaData`
         gains the following
         capabilities:

         * The :class:`.Sequence` will inherit the
           :paramref:`_schema.MetaData.schema`
           parameter specified to the target :class:`_schema.MetaData`, which
           affects the production of CREATE / DROP DDL, if any.

         * The :meth:`.Sequence.create` and :meth:`.Sequence.drop` methods
           automatically use the engine bound to the :class:`_schema.MetaData`
           object, if any.

         * The :meth:`_schema.MetaData.create_all` and
           :meth:`_schema.MetaData.drop_all`
           methods will emit CREATE / DROP for this :class:`.Sequence`,
           even if the :class:`.Sequence` is not associated with any
           :class:`_schema.Table` / :class:`_schema.Column`
           that's a member of this
           :class:`_schema.MetaData`.

         The above behaviors can only occur if the :class:`.Sequence` is
         explicitly associated with the :class:`_schema.MetaData`
         via this parameter.

         .. seealso::

            :ref:`sequence_metadata` - full discussion of the
            :paramref:`.Sequence.metadata` parameter.

        :param for_update: Indicates this :class:`.Sequence`, when associated
         with a :class:`_schema.Column`,
         should be invoked for UPDATE statements
         on that column's table, rather than for INSERT statements, when
         no value is otherwise present for that column in the statement.

        r�r�N)rzr�r�rPr+rf�optionalr_rg�	constructr�rh�_key�
_set_metadatar.r�)r�rfr�r�r�r�r�r�r�rgr�r�r�r�r�r�r�r�s                  rcr�zSequence.__init__�s���n	�!�!�$�:�!�>�� � ������!�!����	!�	
������e�,��	� ��
��\�!�#'�'�D�K�&�
�
!�f�n����#+�?�?�2�D�K�&�%�/�/���E�D�K� ��
�"�4��0��	�����x�(�� �(��3�D�N�!�D�Nrbzsqlalchemy.sql.functionsc�h�tjjjj	|�S)z�Return a :class:`.next_value` function element
        which will render the appropriate increment function
        for this :class:`.Sequence` within any SQL expression.

        )r4r��
sql_functions�func�
next_valuer�s rcr�zSequence.next_valueMs%���~�~�+�+�0�0�;�;�D�A�Arbc���|}t|t�sJ�t�|�
|�|j	|j
�yrk)rlrmr�rZr�r`)r�rYrrrPr�s    �rcrZzSequence._set_parentVs7������&�&�)�)�)�
���F�#�������0rbc�b�t|j|j|j|j|j
|j|j|j|j|j|j|j|j|j|j��S)N)rfr�r�r�r�r�r�r�rgr�r�r�r�r�r�)rrfr�r�r�r�r�r�r�rgr�r�r�r�r�r�r�s rcrtzSequence._copy\sx�������*�*��n�n��]�]��]�]��������*�*��;�;��*�*��*�*��n�n��]�]��]�]����
�	
rbc�:�|j|j�yrk)r�r�)r�rPrns   rcr`zSequence._set_tableos�����5�>�>�*rbc�X�||_||jj|j<yrk)r��
_sequencesr�)r�r�s  rcr�zSequence._set_metadatars!�� ��
�.2��
�
� � ����+rbc�H�|jtj||��y)z&Creates this sequence in the database.r\Nr^ras   rcrczSequence.createvs��	
���c�1�1�4�J��Orbc�H�|jtj||��y)z&Drops this sequence from the database.r\Nreras   rcrgz
Sequence.drop{s��	
���c�/�/��*��Mrbc�\�tjd|jj�d���)NzThis z� cannot be used directly as a column expression.  Use func.next_value(sequence) to produce a 'next value' function that's usable as a column element.)r2r�r�r[r�s rc�_not_a_column_exprzSequence._not_a_column_expr�s1���%�%��D�N�N�+�+�,�-#�
#�
�	
rb)NNNNNNNNNNNFNNNF)$rfr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rgr�r�r�r�r�r�z"Optional[_TypeEngineArgument[int]]r�r�r�r�r�zOptional[MetaData]r�r�r�r�rvr�)rvz
Function[int]r�)rvrrlrk)Tr�)rvr)r[r\r]r�r�rvr�r�r4r�r�rZrtr`r�rcrgr�r�r�s@rcrrjsh���#�J �N��K�!�!�(�(�
 $�#'�"&�"&�%)�%)� $�JN�#� $�8<�� $�'+�'+� �%t"��t"��t"�!�	t"�
 �t"� �
t"�#�t"�#�t"��t"�H�t"��t"��t"�6�t"��t"��t"� %�!t"�"%�#t"�$�%t"�&
�'t"�l�T���3�4�B�5�B�1�
�&+�3�P�
N�

rbrc�b�eZdZUdZdZdZdZdZdZde	d<d
dd�Z
dd�Zdd�Zdd	�Z
dd
�Zdd�Zy)rWa�A marker for a transparent database-side default.

    Use :class:`.FetchedValue` when the database is configured
    to provide some automatic default for a column.

    E.g.::

        Column("foo", Integer, FetchedValue())

    Would indicate that some trigger or default generator
    will create a new value for the ``foo`` column during an
    INSERT.

    .. seealso::

        :ref:`triggered_columns`

    TFr�rPc��||_yrkr�r}s  rcr�zFetchedValue.__init__�r~rbc�F�||jk(r|S|j|�Srk)r��_cloner}s  rcr�zFetchedValue._as_for_update�s"������(��K��;�;�z�*�*rbc�,�t|j�Srk)rWr�r�s rcrtzFetchedValue._copy�s���D�O�O�,�,rbc���|jj|j�}|jj|j�|jj	dd�||_|S)NrP)r�r�r�rr�r�)r�r��ns   rcr�zFetchedValue._clone�sN���N�N�"�"�4�>�>�2��	�
�
���$�-�-�(�	�
�
���x��&�!����rbc��|}t|t�sJ�||_|jr||j_y||j_yrk)rlrmrPr�r�r')r�rYrrrPs    rcrZzFetchedValue._set_parent�s=�����&�&�)�)�)�����?�?�*.�D�K�K�'�)-�D�K�K�&rbc�,�tj|�Srkr�r�s rcr�zFetchedValue.__repr__�s��� � ��&�&rbNr�r��r�r�rvrW)rvrW)r�r�rvr9r�r�)r[r\r]r�r��	reflected�has_argumentrwr�r�r�r�rtr�rZr�rarbrcrWrW�sH���&���I��L����K�!�!�%�+�-��.�'rbc�L��eZdZdZdZ		d							d�fd�
Zdd�Zd	d�Z�xZS)
r�a>A DDL-specified DEFAULT column value.

    :class:`.DefaultClause` is a :class:`.FetchedValue`
    that also generates a "DEFAULT" clause when
    "CREATE TABLE" is emitted.

    :class:`.DefaultClause` is generated automatically
    whenever the ``server_default``, ``server_onupdate`` arguments of
    :class:`_schema.Column` are used.  A :class:`.DefaultClause`
    can be passed positionally as well.

    For example, the following::

        Column("foo", Integer, server_default="50")

    Is equivalent to::

        Column("foo", Integer, DefaultClause("50"))

    Tc���tj|tttfd�t
�|�|�||_||_y)Nr�)	r4�assert_arg_typer�r(r,r�r�r�r�)r�r�r��
_reflectedr�s    �rcr�zDefaultClause.__init__�s9���	
���S�3�
�z�"B�E�J�
����$����#��rbc�Z�t|j|j|j��S)N)r�r�r)r�r�r�r�r�s rcrtzDefaultClause._copy�s"������T�_�_����
�	
rbc�<�d|j�d|j�d�S)NzDefaultClause(z
, for_update=r�r�r�s rcr�zDefaultClause.__repr__�s��59�X�X�t���O�Orb)FF)r�z%Union[str, ClauseElement, TextClause]r�r�rr�rvr�)rvr�r�)	r[r\r]r�r�r�rtr�r�r�s@rcr�r��sM����*�L�
!� �		$�
2�	$��	$��		$�

�	$�
�
Prbr�c���eZdZUdZdZded<ded<							d																	dd�Z						dd	�Zedd
��Z	dd�Z
ejdd
�dd��Z
dd�Zy)�
ConstraintarA table-level SQL constraint.

    :class:`_schema.Constraint` serves as the base class for the series of
    constraint objects that can be associated with :class:`_schema.Table`
    objects, including :class:`_schema.PrimaryKeyConstraint`,
    :class:`_schema.ForeignKeyConstraint`
    :class:`_schema.UniqueConstraint`, and
    :class:`_schema.CheckConstraint`.

    r�intrr�rxNc��||_||_||_|r||_||_||_t
j|�|j|�||_	y)a�Create a SQL constraint.

        :param name:
          Optional, the in-database name of this ``Constraint``.

        :param deferrable:
          Optional bool.  If set, emit DEFERRABLE or NOT DEFERRABLE when
          issuing DDL for this constraint.

        :param initially:
          Optional string.  If set, emit INITIALLY <value> when issuing DDL
          for this constraint.

        :param info: Optional data dictionary which will be populated into the
            :attr:`.SchemaItem.info` attribute of this object.

        :param comment: Optional string that will render an SQL comment on
          foreign key constraint creation.

            .. versionadded:: 2.0

        :param \**dialect_kw:  Additional keyword arguments are dialect
            specific, and passed in the form ``<dialectname>_<argname>``.  See
            the documentation regarding an individual dialect at
            :ref:`dialect_toplevel` for detail on documented arguments.

        :param _create_rule:
          used internally by some datatypes that also create constraints.

        :param _type_bound:
          used internally to indicate that this constraint is associated with
          a specific datatype.

        N)
rfr.r/r��_create_rulerwr4r�rr�)	r�rfr.r/r�r�r
rwr2s	         rcr�zConstraint.__init__sW��\��	�$���"�����D�I�(���&�������%��%�%�j�1���rbc��|j�|j|�sy|j�4|jjtj|�|dfd|i|��Sy)NF�compilerT)r
r��_should_executer�CreateConstraint)r�rrrs   rc�_should_create_for_compilerz&Constraint._should_create_for_compiler<sj�����(��1B�1B�8�1L��
�\�\�
%�/�4�<�<�/�/��$�$�T�*�D�$��AI��MO��
�rbc��	t|jt�r|jS	t	j
d��#t$rY� wxYw)NzdThis constraint is not bound to a table.  Did you mean to call table.append_constraint(constraint) ?)rlrYrVr�r2r�r�s rcrnzConstraint.tableHsS��	��$�+�+�u�-��{�{�"�.��%�%�
A�
�	
���	��	�s�%>�	A
�	A
c�x�t|ttf�sJ�||_|jj|�yrk)rlrVrmrYr�rKras   rcrZzConstraint._set_parentTs1���&�5�&�/�2�2�2���������t�$rbr�zaThe :meth:`_schema.Constraint.copy` method is deprecated and will be removed in a future release.c�&�|jdi|��Sr�r�r�s  rcr�zConstraint.copyYr�rbc��t��rkr�r�s  rcrtzConstraint._copyar�rb)NNNNNNF)rfrir.r�r/r�r�rr�r�r
r�rwr�r2rrvr�)rrCrrrrvr��rvrVr�)rrrrvr9)r[r\r]r�r�r�r�rr�rnrZr4r�r�rtrarbrcrr�s���	�"�N�����)-�%)�#'�$(�!%�&*�!�7�%�7�#�7�!�	7�
"�7��
7�$�7��7��7�
�7�r
�#�
�+.�
�	
�
��	
��	
�%�
�T�_�_�
�	3��
 ��
 �$rbrc���eZdZUdZded<dZded<er
						dd�Zddd	d
�									dd�Zddd�Z	e
jdd
��Ze
jdd��Z
				dd�Zdd�Zy	)�ColumnCollectionMixinz�A :class:`_expression.ColumnCollection` of :class:`_schema.Column`
    objects.

    This collection represents the columns which are referred to by
    this object.

    r�r�Fz'List[Optional[Union[str, Column[Any]]]]�_pending_colargsc��yrkraras   rcr�z/ColumnCollectionMixin._set_parent_with_dispatchvs��rbTN)�_autoattachrx�_gather_expressionsc��||_t�|_|}|�f|rJ�g|_t	j
tj|�D]3\}}}}|jj|�|j|��5n7|D�	cgc]&}	t	jtj|	���(c}	|_|r|jr|j�yyycc}	wrk)rxr#r�rr� expect_col_expression_collectionr�DDLConstraintColumnRolersr�
_check_attach)
r�rrxrr��processed_expressionsr�r��add_elementrPs
          rcr�zColumnCollectionMixin.__init__zs���)���.�0��
�
 �	�!�,�-�,�,�$&�D�!��;�;��-�-�w��������%�%�,�,�[�9�%�,�,�T�2�	�&�%�%�F�� � ��!>�!>��G�%�%�D�!�
�4�0�0���� �1�;��%s�+Cc���
��jD�cgc]}t|t�s�|��}}|D�cgc]}t|jt�s�|��!}}t|�j
|��
�
r^|rJd���jD�chc]}|��|��	c}j
|�}|s'd
�
�fd�}�
�_�
D]}|j|��y|}|D�chc]}|j��}	}t|	�dk(r �j|	j��yt|	�dkDr~�jsq|dj}
|ddD�cgc]}|j|
us�|��}}|r>djd�|D��}tjd|�d|
j �d	���yyycc}wcc}wcc}wcc}wcc}w)Nz#Should not reach here on event callc�t��t|t�r'�j|��s�jd��yyy)NT)r�)rlrV�discardr)rPrn�
cols_wo_tabler�s  ��rc�
_col_attachedz:ColumnCollectionMixin._check_attach.<locals>._col_attached�s;���"�%��/�%�-�-�f�5�,� �.�.�4�.�8� -�0rbrrr?c3�&K�|]	}d|z���y�w�z'%s'Nra��.0rps  rc�	<genexpr>z6ColumnCollectionMixin._check_attach.<locals>.<genexpr>�s����%A�&�Q�f�q�j�&�s�z
Column(s) z are not part of table 'r�rl)rrlrmrnrVr��
difference�_cols_wo_tabler�rHr�r��_allow_multiple_tablesrBr2r�rH)r�r�rp�col_objs�cols_w_table�has_string_colsr%r|r�r�rn�others�	other_strr$s`            @rcrz#ColumnCollectionMixin._check_attach�s����#�4�4�N�4�!�
�1�f�8M�A�4��N�#+�J�8�a�z�!�'�'�5�/I��8��J��H�
�0�0��>�
���A�A�A�7�
 �0�0��0�a�A�M��0���j��"�
�#�9�'4��#�(�C��(�(��7�)����#*�+�7�a�!�'�'�7��+��v�;�!���*�*�6�:�:�<�8�
��[�1�_�T�%@�%@��A�J�$�$�E�!(����E��A����u�0D�a��F�E�� �I�I�%A�&�%A�A�	��'�'� ���,.�.3�.?�.?�-@��D����&A�_��IO��J����*,��
Fs3�F'�F'�F,�F,�
F1�F1�F6�
F;�F;c�6�|jj�Srk�r��as_readonlyr�s rcr�zColumnCollectionMixin.columns�����}�}�(�(�*�*rbc�6�|jj�Srkr4r�s rcrpzColumnCollectionMixin.c�r6rbc
��t|t�rO|jD�cgc]}t|t�s�|��}}t|�t|j�k(sJ�|S	|jD�cgc]#}t|t�r|j
|n|��%c}Scc}wcc}w#t$rP}tjd|jj�d|j�d|jd�d��|�d}~wwxYw)Nz
Can't create z on table 'z': no column named 'rz
' is present.)
rlrmrrHr�rp�KeyErrorr2�ConstraintColumnNotFoundErrorr�r[rHr�)r�rYrp�resultr|�kes      rc�_col_expressionsz&ColumnCollectionMixin._col_expressions�s���f�f�%��0�0�3�0�a�J�q�&�4I��0�
�3��v�;�#�d�&;�&;�"<�<�<�<��M�

� $�4�4��4��&0��S�%9�F�H�H�S�M�s�B�4����3�����
��7�7�#�D�N�N�$;�$;�#<�=!�!'�!3�!3� 4�5� �g�g�a�j�\��8���	��
�s5�B�B�!B$�/(B�B$�B$�$	C=�-AC8�8C=c��t|ttf�sJ�|j|�D] }|��|jj|��"yrk)rlrVrmr=r�rK)r�rYrrr|s    rcrZz!ColumnCollectionMixin._set_parent�sB���&�5�&�/�2�2�2��(�(��0�C����
�
�!�!�#�&�1rbr�)
r�r=rr�rxr�rz.Optional[List[Union[str, ColumnElement[Any]]]]rvr�r�)r�r�rvr�r�)rYzUnion[Table, Column[Any]]rvzList[Optional[Column[Any]]])r[r\r]r�r�r-rr�r�rr4r�r�rpr=rZrarbrcrres����2�1�"��=�=��	�+�	�36�	�
�	�!�"�
�'!�$�'!��'!��	'!�

�'!�
�'!�R.�`
���+��+�
���+��+��/��	$��,'rbrc���eZdZUdZdddddddd�																			dd�Zded<	dd	�Zdd
�Zejdd�dd
�					dd��Z
dd
�					dd�Zdd�Zdd�Z
dd�Zy)�ColumnCollectionConstraintz-A constraint that proxies a ColumnCollection.NTF)rfr.r/r�rrxrr�c�n�tj|f||||d�|	��tj|g|��||d��y)al
        :param \*columns:
          A sequence of column names or Column objects.

        :param name:
          Optional, the in-database name of this constraint.

        :param deferrable:
          Optional bool.  If set, emit DEFERRABLE or NOT DEFERRABLE when
          issuing DDL for this constraint.

        :param initially:
          Optional string.  If set, emit INITIALLY <value> when issuing DDL
          for this constraint.

        :param \**dialect_kw: other keyword arguments including
          dialect-specific arguments are propagated to the :class:`.Constraint`
          superclass.

        �rfr.r/r�)rrxN)rr�r)
r�rfr.r/r�rrxrr�r2s
          rcr�z#ColumnCollectionConstraint.__init__�sV��@	����	
��!���	
��
	
�	�&�&��	
��	
�(3�,�	
rbr�c��t|ttf�sJ�tj	||�t
j	||�yrk)rlrmrVrrZrras   rcrZz&ColumnCollectionConstraint._set_parent.s6���&�6�5�/�2�2�2����t�V�,��)�)�$��7rbc��||jvSrk)r�)r�rEs  rc�__contains__z'ColumnCollectionConstraint.__contains__3s���D�M�M�!�!rbr�zqThe :meth:`_schema.ColumnCollectionConstraint.copy` method is deprecated and will be removed in a future release.�rzc�*�|jdd|i|��S�Nrzrar��r�rzrrs   rcr�zColumnCollectionConstraint.copy6s���t�z�z�:�|�:�r�:�:rbc
���i}|jD]>}|j|j}|j�D]\}}|||dz|z<��@t|jt
�sJ�|j|jD�cgc]}t||j|���c}|j|j|j|jd�|��}	|j|	�Scc}w)Nr�)rfr.r/r�)r�r�r�rlrYrVr�r�r{rfr.r/r�r�)
r�rzrr�constraint_kwargsr�r�r�r�r�rps
          rcrtz ColumnCollectionConstraint._copyCs����� �0�0�L�"�2�2�<�@�N�N�O�!�&�&�(��"�$�)�"�,��"4�7I�"I�J�)�1��$�+�+�u�-�-�-��D�N�N�!�M�M��)�D�!��t�{�{�L�A�)���������n�n�
�L�L�

� �

���%�%�a�(�(��s�C)c�8�|jj|�S)z�Return True if this constraint contains the given column.

        Note that this object also contains an attribute ``.columns``
        which is a :class:`_expression.ColumnCollection` of
        :class:`_schema.Column` objects.

        )r��contains_column�r�r|s  rcrMz*ColumnCollectionConstraint.contains_columncs���}�}�,�,�S�1�1rbc�,�t|j�Srk)�iterr�r�s rc�__iter__z#ColumnCollectionConstraint.__iter__ns���D�M�M�"�"rbc�,�t|j�Srk)rHr�r�s rc�__len__z"ColumnCollectionConstraint.__len__qs���4�=�=�!�!rb)r�r=rfrir.r�r/r�r�rrr�rxr�rz"Optional[List[_DDLColumnArgument]]r2rrvr�r�)rErrvr�)rz�Optional[Table]rrrrvr@)r|rrvr�)rvzIterator[Column[Any]])rvr)r[r\r]r�r�r�rZrEr4r�r�rtrMrQrSrarbrcr@r@�s��7�
)-�%)�#'�$(� �"�BF�*
�$�*
�&�*
�#�	*
�
!�*
�"�
*
��*
��*
�@�*
��*
�
�*
�X8�7��
8�
"��T�_�_�
�	A��)-�;�&�;��	;�

$�;��
;�)-�)�&�)��	)�

$�)�@	2�#�"rbr@c����eZdZdZdZdZeddd�								d																					d�fd�
�Zedd	��Z	e
jd
d�dd�					dd
��Zdd�					dd�Z
�xZS)�CheckConstraintzlA table- or column-level CHECK constraint.

    Can be included in the definition of a Table or Column.
    T� table_or_column_check_constraint�sqltextz:class:`.CheckConstraint`z$:paramref:`.CheckConstraint.sqltext`Nc
���tjtj|�|_g}tj|jid|ji�t�|�$|||||||	|d�|
��|�|j|�yy)a�Construct a CHECK constraint.

        :param sqltext:
         A string containing the constraint definition, which will be used
         verbatim, or a SQL expression construct.   If given as a string,
         the object is converted to a :func:`_expression.text` object.
         If the textual
         string includes a colon character, escape this using a backslash::

           CheckConstraint(r"foo ~ E'a(?\:b|c)d")

        :param name:
          Optional, the in-database name of the constraint.

        :param deferrable:
          Optional bool.  If set, emit DEFERRABLE or NOT DEFERRABLE when
          issuing DDL for this constraint.

        :param initially:
          Optional string.  If set, emit INITIALLY <value> when issuing DDL
          for this constraint.

        :param info: Optional data dictionary which will be populated into the
            :attr:`.SchemaItem.info` attribute of this object.

        rP)rfr.r/r
r�rwrN)rrr�DDLExpressionRolerXr�traversersr�r�r�)
r�rXrfr.r/rnr�r
rrwr2r�r�s
            �rcr�zCheckConstraint.__init__s����Z!�'�'��(?�(?��I���%'�����$�,�,��X�w�~�~�,F�G�
�����!��%��#�#�
	
��
	
����*�*�5�1�rbc�8�t|jt�Srk)rlrYrVr�s rc�is_column_levelzCheckConstraint.is_column_level�s���d�k�k�5�1�1�1rbr�zfThe :meth:`_schema.CheckConstraint.copy` method is deprecated and will be removed in a future release.rFc�*�|jdd|i|��SrHr�rIs   rcr�zCheckConstraint.copy�����t�z�z�:�|�:�r�:�:rbc�$�|�"t|j|j|�}n|j}t||j|j
|j|j||jd|j��	}|j|�S)NF)rfr/r.r
rnr�rrw)r{rXrnrVrfr/r.r
r�rwr�)r�rzrrrXrps     rcrtzCheckConstraint._copy�s���#�'�t�|�|�T�Z�Z��N�G��l�l�G�������n�n�����*�*���L�L���(�(�

���%�%�a�(�(rb)NNNNNNTF)rXz#_TextCoercedExpressionArgument[Any]rfrir.r�r/r�rnrTr�rr
r�rr�rwr�r2rrvr�r)rzrTrrrrvrV)r[r\r]r�r-r�r'r�r�r]r4r�r�rtr�r�s@rcrVrVus6����
"��7�N���#�.��)-�%)�#'�!%�$(�&*� �!�82�4�82�&�82�#�	82�
!�82��
82�"�82�$�82��82��82��82�
�82��
82�t�2��2��T�_�_�
�	3��26�;�.�;�=@�;�	�;��
;�26�)�.�)�=@�)�	�)rbrVc�b�eZdZUdZdZ											d																													dd�Zdd�Zded<	ded	<	edd
��Z	edd��Z
edd��Zdd
�Zedd��Z
edd��Zdd�Zej"dd�ddd�							d d��Zddd�							d d�Zy)!rua�A table-level FOREIGN KEY constraint.

    Defines a single column or composite FOREIGN KEY ... REFERENCES
    constraint. For a no-frills, single column foreign key, adding a
    :class:`_schema.ForeignKey` to the definition of a :class:`_schema.Column`
    is a
    shorthand equivalent for an unnamed, single column
    :class:`_schema.ForeignKeyConstraint`.

    Examples of foreign key configuration are in :ref:`metadata_foreignkeys`.

    �foreign_key_constraintNr�c���tj|f|||||
d�|��||_||_|	|_||_|
|_tt|��t|�k7rJtt|��t|�k7rtjd��tjd��|D�cgc]r}t|f||j|j|j|j
|j|j|j|jd�	|j����tc}|_t#j|g|���|�.t%|d�r||j&usJ�|j)|�yycc}w)a�Construct a composite-capable FOREIGN KEY.

        :param columns: A sequence of local column names. The named columns
          must be defined and present in the parent Table. The names should
          match the ``key`` given to each column (defaults to the name) unless
          ``link_to_name`` is True.

        :param refcolumns: A sequence of foreign column names or Column
          objects. The columns must all be located within the same Table.

        :param name: Optional, the in-database name of the key.

        :param onupdate: Optional string. If set, emit ON UPDATE <value> when
          issuing DDL for this constraint. Typical values include CASCADE,
          DELETE and RESTRICT.

        :param ondelete: Optional string. If set, emit ON DELETE <value> when
          issuing DDL for this constraint. Typical values include CASCADE,
          SET NULL and RESTRICT.

        :param deferrable: Optional bool. If set, emit DEFERRABLE or NOT
          DEFERRABLE when issuing DDL for this constraint.

        :param initially: Optional string. If set, emit INITIALLY <value> when
          issuing DDL for this constraint.

        :param link_to_name: if True, the string name given in ``column`` is
          the rendered name of the referenced column, not its locally assigned
          ``key``.

        :param use_alter: If True, do not emit the DDL for this constraint as
          part of the CREATE TABLE definition. Instead, generate it via an
          ALTER TABLE statement issued after the full collection of tables
          have been created, and drop it via an ALTER TABLE statement before
          the full collection of tables are dropped.

          The use of :paramref:`_schema.ForeignKeyConstraint.use_alter` is
          particularly geared towards the case where two or more tables
          are established within a mutually-dependent foreign key constraint
          relationship; however, the :meth:`_schema.MetaData.create_all` and
          :meth:`_schema.MetaData.drop_all`
          methods will perform this resolution
          automatically, so the flag is normally not needed.

          .. seealso::

                :ref:`use_alter`

        :param match: Optional string. If set, emit MATCH <value> when issuing
          DDL for this constraint. Typical values include SIMPLE, PARTIAL
          and FULL.

        :param info: Optional data dictionary which will be populated into the
            :attr:`.SchemaItem.info` attribute of this object.

        :param comment: Optional string that will render an SQL comment on
          foreign key constraint creation.

            .. versionadded:: 2.0

        :param \**dialect_kw:  Additional keyword arguments are dialect
          specific, and passed in the form ``<dialectname>_<argname>``.  See
          the documentation regarding an individual dialect at
          :ref:`dialect_toplevel` for detail on documented arguments.

        )rfr.r/r�r�zOForeignKeyConstraint with duplicate source column references are not supported.z_ForeignKeyConstraint number of constrained columns must match the number of referenced columns.)	r
rfr�r-r,r�r0r.r/NrY)rr�r�r-r�r,r0rHr�r2r�rrfr.r/r��elementsrr�rYr�)r�r��
refcolumnsrfr�r-r.r/r,r�r0rnr�r�r2�refcols                rcr�zForeignKeyConstraint.__init__�s���h	����	
��!����
	
��	
�!��
� ��
�(���"�����
��s�7�|���J��/��3�w�<� �C��L�0��'�'�4����'�'�*���0%�
�%��
��
� ��Y�Y��������.�.�!�.�.��j�j��?�?��.�.�
��%�%�
�%�
��
�"	�&�&�t�6�g�6����t�X�&�����+�+�+��*�*�5�1���%
s�.A7E4c�p�|jj|�|jj|�yrk)r�rKrdrsr�s   rcrhz$ForeignKeyConstraint._append_element�s&���
�
���&�!��
�
���R� rbr�zList[ForeignKey]rdc�h�tjt|j|j��Srk)r4�OrderedDict�zip�column_keysrdr�s rc�	_elementszForeignKeyConstraint._elements�s&������D�$4�$4�d�m�m� D�E�Erbc�@�|jD]}|jcSyrk)rdrv)r��elems  rcrvz%ForeignKeyConstraint._referred_schema�s!���M�M�D��(�(�(�"�rbc�H�|jdjjS)aKThe :class:`_schema.Table` object to which this
        :class:`_schema.ForeignKeyConstraint` references.

        This is a dynamically calculated attribute which may not be available
        if the constraint and/or parent table is not yet associated with
        a metadata collection that contains the referred table.

        r)rdrPrnr�s rc�referred_tablez#ForeignKeyConstraint.referred_table�s���}�}�Q��&�&�,�,�,rbc
��|jD�chc]}|j���}}d|vrUt|�dkDrFt|�dd\}}t	j
d|j�d|j�d|�d|����yycc}w)Nrrr0zForeignKeyConstraint on r�z$) refers to multiple remote tables: � and )rdrArHrr2r�r��_col_description)r�rnrn�
table_keys�elem0�elem1s      rcrcz)ForeignKeyConstraint._validate_dest_table�s���48�M�M�B�M�D�d�o�o�'�M�
�B��z�!�c�*�o��&9�!�*�-�a��2�L�E�5��#�#�*��>�>�"�!�D�$9�$9�#:�;+�+0�'��u�g�?��
�':�!��Cs�Bc���t|d�r|jj�S|jD�cgc])}t	|t
�r|jn
t|���+c}Scc}w)a�Return a list of string keys representing the local
        columns in this :class:`_schema.ForeignKeyConstraint`.

        This list is either the original string arguments sent
        to the constructor of the :class:`_schema.ForeignKeyConstraint`,
        or if the constraint has been initialized with :class:`_schema.Column`
        objects, is the string ``.key`` of each element.

        rY)r�r��keysrrlr*ror�rNs  rcrkz ForeignKeyConstraint.column_keys�sd���4��"��=�=�%�%�'�'� �0�0��0�C�&�c�=�9����s�3�x�G�0��
��s�.A&c�8�dj|j�S)Nr?)rBrkr�s rcrsz%ForeignKeyConstraint._col_description�s���y�y��)�)�*�*rbc�N�|}t|t�sJ�tj||�tj||�t|j|j�D]1\}}t|d�r|j|us�!|j|��3|j|�y)NrY)rlrVrrZr@rjr�rdr�rYr�rc)r�rYrrrnr|r�s      rcrZz ForeignKeyConstraint._set_parent�s������%��'�'�'����t�U�+�"�.�.�t�U�;��4�=�=�$�-�-�8�G�C���2�x�(�B�I�I�S�,@��,�,�S�1�9�	
�!�!�%�(rbr�zkThe :meth:`_schema.ForeignKeyConstraint.copy` method is deprecated and will be removed in a future release.roc�,�|jd||d�|��S)Nrorar�)r�rgrzrrs    rcr�zForeignKeyConstraint.copy�s���t�z�z�I��l�I�b�I�Irbc
��t|jD�cgc]}|jj��c}|jD�cgc]U}|j	||�=|j�|jjjk(r|jndd����Wc}|j|j|j|j|j|j|j|j|j��}t!|j|j�D]\}}|j#|��|j#|�Scc}wcc}w)NT)rgr9r:)	rfr�r-r,r.r/r�r0r�)rurdrYror4rArnrfr�r-r,r.r/r�r0r�rjr�)r�rgrzrrrEr�self_fk�other_fks        rcrtzForeignKeyConstraint._copy�s&��#�#'�=�=�1�=�a�Q�X�X�\�\�=�1����
�'�A����!�(�3��L�L�N�a�h�h�n�n�.@�.@�@�%�)�)�"�!��	�'�
�����]�]��]�]��n�n�����n�n��*�*��*�*��L�L�/
��2"%�T�]�]�C�L�L�!A��G�X��%�%�h�/�"B��%�%�c�*�*��5
2��
s�E�AE
)NNNNNFFNNNN)r��$_typing_Sequence[_DDLColumnArgument]rerrfrir�r�r-r�r.r�r/r�r,r�r�r�r0r�rnrTr�rr�r�r2rrvr�)rPrr�rrvr�)rvz!util.OrderedDict[str, ForeignKey]rjrr�)rvz_typing_Sequence[str]r�r�)rgr�rzrTrrrrvru)r[r\r]r�r�r�rhr�r�rlrvrprcrkrsrZr4r�r�rtrarbrcruru�s����.�N�)-�"&�"&�%)�#'��"�#�!%�$(�!%�M2�5�M2�9�M2�&�	M2�
 �M2� �
M2�#�M2�!�M2��M2��M2��M2��M2�"�M2��M2��M2� 
�!M2�^!�8�7��
����F��F������	-��	-������$�+��+�)��T�_�_�
�	3��!%�(,�	J��J�&�	J�
�J�
�
J��
J�!%�(,�	"+��"+�&�	"+�
�"+�
�
"+rbruc���eZdZdZdZdddddd�															d�fd�Zd
�fd�Zdd�Zdd	�Ze	dd
��Z
ejdd��Z
�xZS)r�a7
A table-level PRIMARY KEY constraint.

    The :class:`.PrimaryKeyConstraint` object is present automatically
    on any :class:`_schema.Table` object; it is assigned a set of
    :class:`_schema.Column` objects corresponding to those marked with
    the :paramref:`_schema.Column.primary_key` flag::

        >>> my_table = Table(
        ...     "mytable",
        ...     metadata,
        ...     Column("id", Integer, primary_key=True),
        ...     Column("version_id", Integer, primary_key=True),
        ...     Column("data", String(50)),
        ... )
        >>> my_table.primary_key
        PrimaryKeyConstraint(
            Column('id', Integer(), table=<mytable>,
                   primary_key=True, nullable=False),
            Column('version_id', Integer(), table=<mytable>,
                   primary_key=True, nullable=False)
        )

    The primary key of a :class:`_schema.Table` can also be specified by using
    a :class:`.PrimaryKeyConstraint` object explicitly; in this mode of usage,
    the "name" of the constraint can also be specified, as well as other
    options which may be recognized by dialects::

        my_table = Table(
            "mytable",
            metadata,
            Column("id", Integer),
            Column("version_id", Integer),
            Column("data", String(50)),
            PrimaryKeyConstraint("id", "version_id", name="mytable_pk"),
        )

    The two styles of column-specification should generally not be mixed.
    An warning is emitted if the columns present in the
    :class:`.PrimaryKeyConstraint`
    don't match the columns that were marked as ``primary_key=True``, if both
    are present; in this case, the columns are taken strictly from the
    :class:`.PrimaryKeyConstraint` declaration, and those columns otherwise
    marked as ``primary_key=True`` are ignored.  This behavior is intended to
    be backwards compatible with previous behavior.

    For the use case where specific options are to be specified on the
    :class:`.PrimaryKeyConstraint`, but the usual style of using
    ``primary_key=True`` flags is still desirable, an empty
    :class:`.PrimaryKeyConstraint` may be specified, which will take on the
    primary key column collection from the :class:`_schema.Table` based on the
    flags::

        my_table = Table(
            "mytable",
            metadata,
            Column("id", Integer, primary_key=True),
            Column("version_id", Integer, primary_key=True),
            Column("data", String(50)),
            PrimaryKeyConstraint(name="mytable_pk", mssql_clustered=True),
        )

    �primary_key_constraintNF)rfr.r/r�r�c�<��||_t�|�|||||d�|��y)NrB)r�r�r�)	r�rfr.r/r�r�r�r2r�s	        �rcr�zPrimaryKeyConstraint.__init__Ss3���$7�� �
���
��!���	
��
	
rbc� ��|}t|t�sJ�t�|�
|�|j|urG|j
j
|j�||_|j
j|�|jD�cgc]}|js�|��}}|jr�|r�t|�t|j�k7rkdjd�|D��}djd�|jD��}tjd|j�d|�d|�d|�d�	�g|dd|jD]#}d	|_|jt us�d
|_�%|r|jj%|�yycc}w)Nr?c3�:K�|]}d|jz���y�wr'�rfr(s  rcr*z3PrimaryKeyConstraint._set_parent.<locals>.<genexpr>xs����$H�i��V�a�f�f�_�i���c3�:K�|]}d|jz���y�wr'r�r(s  rcr*z3PrimaryKeyConstraint._set_parent.<locals>.<genexpr>ys����G��A�������r�r�z' specifies columns z= as primary_key=True, not matching locally specified columns z-; setting the current primary key columns to z:. This warning may become an exception in a future releaseTF)rlrVr�rZr�r�r#rKrpr�r�rBr4rrrfr�r`r(�extend)	r�rYrrrnrp�	table_pks�table_pk_str�col_strr�s	        �rcrZz PrimaryKeyConstraint._set_parentgsk������%��'�'�'�
���E�"����D�(����%�%�e�&7�&7�8� $�E�����!�!�$�'� %���9��1�1�=�=�Q��	�9��M�M���I��#�d�m�m�"4�4� �9�9�$H�i�$H�H�L��i�i�G����G�G�G��I�I��%�*�*��%9��.�!:�:A��C2��)�>�
?�

��I�a�L����A� �A�M��'�'�+;�;�"��
����M�M� � ��+���7:s�F�Fc���|D]	}d|_�|jj|�tjj|�|j
|j�y)aKrepopulate this :class:`.PrimaryKeyConstraint` given
        a set of columns.

        Existing columns in the table that are marked as primary_key=True
        are maintained.

        Also fires a new event.

        This is basically like putting a whole new
        :class:`.PrimaryKeyConstraint` object on the parent
        :class:`_schema.Table` object without actually replacing the object.

        The ordering of the given list of columns is also maintained; these
        columns will be appended to the list of columns after any which
        are already present.

        TN)r�r�r�r�r!�_resetr�rn)r�r�r|s   rc�_reloadzPrimaryKeyConstraint._reload�sO��*�C�"�C�O��	
�
�
���W�%��2�2�9�9�$�?��&�&�t�z�z�2rbc��tjj|�|jj	|�|j
j
||�yrk)r�r!r�r�rur��'_sa_event_column_added_to_pk_constraintrNs  rcr�zPrimaryKeyConstraint._replace�s<���2�2�9�9�$�?��
�
���c�"��
�
�=�=�d�C�Hrbc��|j}|�#|g|jD�cgc]	}||us�|��c}zSt|j�Scc}wrk)r!r�r�)r��autoincrps   rc�columns_autoinc_firstz*PrimaryKeyConstraint.columns_autoinc_first�sO���,�,�����9�4�=�=�M�=�a�A�W�<L��=�M�M�M���
�
�&�&�� Ns
�	A�Ac��d
d�}t|j�dk(rKt|j�d}|jdur||d�|S|jdvr||d�r|Syd}|jD]N}|jdus�||d�|�0t	j
d|j�d|j�d	���|}�P|S)Nc��|jj�Rt|jjtjjtj
jf�s)|r&t
jd|j�d|�d���yt|jtd�tf�s|sy|j�t|jt�s|sy|jr|jdvryy)NzColumn type z on column 'z+' is not compatible with autoincrement=TrueF)T�	ignore_fkT)r��_type_affinity�
issubclassrr%�NUMERICTYPEr2r�rlr~rr'r�r�r�)r|�autoinc_trues  rc�_validate_autoinczEPrimaryKeyConstraint._autoincrement_column.<locals>._validate_autoinc�s����x�x�&�&�.�j����'�'��(�(�7�7��(�(�7�7��7� ��+�+�&�s�x�x�j��S�E�B=�>���
!��s�{�{�T�$�Z��,B�C�$���"�"�.�"�3�#5�#5�x�@�$���!�!�c�&7�&7�@�'��rbrrT)r�r�Fz=Only one Column may be marked autoincrement=True, found both rrre)r|rr�r�rvr�)rHr�r�r�r2r�rf)r�r�r|r�s    rcr!z*PrimaryKeyConstraint._autoincrement_column�s���	�B�t�}�}���"��t�}�}�%�a�(�C�� � �D�(�!�#�t�,��
��"�"�'��$�C��/��
���G��}�}���$�$��,�%�c�4�0��*�!�/�/�>�"�x�x�j��g�l�l�^�1�>���#&��%��Nrb)r�r=rfr�r.r�r/r�r�rr�r�r2rrvr�r�)r�zIterable[Column[Any]]rvr�)r|rrvr�)rvzList[Column[Any]]r�)r[r\r]r�r�r�rZr�r�r�r�r4r�r!r�r�s@rcr�r�s����=�~.�N�
#�%)�#'�$(�$)�
�$�
��
�#�	
�
!�
�"�

�"�
��
�
�
�(&,�P3�:I��'��'�
���>��>rbr�c��eZdZdZdZy)r�aA table-level UNIQUE constraint.

    Defines a single column or composite UNIQUE constraint. For a no-frills,
    single column constraint, adding ``unique=True`` to the ``Column``
    definition is a shorthand equivalent for an unnamed, single column
    UniqueConstraint.
    �unique_constraintN)r[r\r]r�r�rarbrcr�r��s���)�Nrbr�c��eZdZUdZdZded<ded<ded<d	d
d
d
d	d�																	dd�Zdd
�Zddd�Zddd�Z	dd�Z
y
)rya�A table-level INDEX.

    Defines a composite (one or more column) INDEX.

    E.g.::

        sometable = Table(
            "sometable",
            metadata,
            Column("name", String(50)),
            Column("address", String(100)),
        )

        Index("some_index", sometable.c.name)

    For a no-frills, single column index, adding
    :class:`_schema.Column` also supports ``index=True``::

        sometable = Table(
            "sometable", metadata, Column("name", String(50), index=True)
        )

    For a composite index, multiple columns can be specified::

        Index("some_index", sometable.c.name, sometable.c.address)

    Functional indexes are supported as well, typically by using the
    :data:`.func` construct in conjunction with table-bound
    :class:`_schema.Column` objects::

        Index("some_index", func.lower(sometable.c.name))

    An :class:`.Index` can also be manually associated with a
    :class:`_schema.Table`,
    either through inline declaration or using
    :meth:`_schema.Table.append_constraint`.  When this approach is used,
    the names
    of the indexed columns can be specified as strings::

        Table(
            "sometable",
            metadata,
            Column("name", String(50)),
            Column("address", String(100)),
            Index("some_index", "name", "address"),
        )

    To support functional or expression-based indexes in this form, the
    :func:`_expression.text` construct may be used::

        from sqlalchemy import text

        Table(
            "sometable",
            metadata,
            Column("name", String(50)),
            Column("address", String(100)),
            Index("some_index", text("lower(name)")),
        )

    .. seealso::

        :ref:`schema_indexes` - General information on :class:`.Index`.

        :ref:`postgresql_indexes` - PostgreSQL-specific options available for
        the :class:`.Index` construct.

        :ref:`mysql_indexes` - MySQL-specific options available for the
        :class:`.Index` construct.

        :ref:`mssql_indexes` - MSSQL-specific options available for the
        :class:`.Index` construct.

    r�rTrnz0_typing_Sequence[Union[str, ColumnElement[Any]]]�expressionsz$_typing_Sequence[ColumnElement[Any]]rzFN)rpr�r�rqrxc��dx|_}	tj||�|_||_|�||_|�|}	|j
|�g|_tj|g|��||jd��|	�|j|	�yy)avConstruct an index object.

        :param name:
          The name of the index

        :param \*expressions:
          Column expressions to include in the index.   The expressions
          are normally instances of :class:`_schema.Column`, but may also
          be arbitrary SQL expressions which ultimately refer to a
          :class:`_schema.Column`.

        :param unique=False:
            Keyword only argument; if True, create a unique index.

        :param quote=None:
            Keyword only argument; whether to apply quoting to the name of
            the index.  Works in the same manner as that of
            :paramref:`_schema.Column.quote`.

        :param info=None: Optional data dictionary which will be populated
            into the :attr:`.SchemaItem.info` attribute of this object.

        :param \**dialect_kw: Additional keyword arguments not mentioned above
            are dialect specific, and passed in the form
            ``<dialectname>_<argname>``. See the documentation regarding an
            individual dialect at :ref:`dialect_toplevel` for detail on
            documented arguments.

        N)rxr)rnr+r�rfrpr�rr�rr�rZ)
r�rfrpr�r�rqrxr�r2rns
          rcr�zIndex.__init__]s���P"�!��
�U��)�)�$��6��	�������D�I����E��%�%�j�1����	�&�&��	
�
�	
�&� $� 0� 0�		
������U�#�rbc	��|}t|t�sJ�tj||�|j�U||jurGtjd|j�d|jj�d|j�d���||_|jj|�|j}|j|�}t|�t|�k(sJ�g}t||�D]<\}}t|t�r|j!|��(|�|j!|��<J�|x|_|_y)NzIndex 'z' is against table 'z(', and cannot be associated with table 'r�)rlrVrrZrnr2r�rfrHr�rKr�r=rHrjr(rsrz)	r�rYrrrnr��col_expressions�exprsr��colexprs	         rcrZzIndex._set_parent�s0�����%��'�'�'��)�)�$��6��:�:�!�e�4�:�:�&=��#�#��$�)�)��%��J�J�*�*�+�,4�49�4E�4E�3F�b�J��
�
��
�
�
�
���$���&�&���/�/��6���;��3��#7�7�7�7��� ��o�>�M�D�'��$�
�.����T�"��$����W�%��u�
?�<A�@���4�8rbc�H�|jtj||��y)z�Issue a ``CREATE`` statement for this
        :class:`.Index`, using the given
        :class:`.Connection` or :class:`.Engine`` for connectivity.

        .. seealso::

            :meth:`_schema.MetaData.create_all`.

        r\Nr^ras   rcrczIndex.create�s��	
���c�1�1�4�J��Orbc�H�|jtj||��y)z�Issue a ``DROP`` statement for this
        :class:`.Index`, using the given
        :class:`.Connection` or :class:`.Engine` for connectivity.

        .. seealso::

            :meth:`_schema.MetaData.drop_all`.

        r\Nreras   rcrgz
Index.drop�rhrbc
���ddjt|j�g|jD�cgc]
}t|���c}z|jxrdgxsgz�zScc}w)Nz	Index(%s)r?zunique=True)rBrCrfr�rp)r��es  rcr�zIndex.__repr__�sk����I�I��d�i�i��!�$(�$4�$4�5�$4�q�4��7�$4�5�6��;�;�2�M�?�8�b�:�
�
�	
��6s�A#)rfr�r�r=rpr�r�r�r�rrqrTrxr�r2rrvr�r�r�r�r�)r[r\r]r�r�r�r�rZrcrgr�rarbrcryry	s���I�V�N���A�A�B�B�� $�$(�"&�"�@$��@$�)�@$��	@$�
�@$�"�
@$� �@$��@$��@$�
�@$�DA�8
P�
N�	
rbryc�@�eZdZUded<ded<ded<ded<ded<y)�_NamingSchemaTD�_NamingSchemaDirectiver��pk�ix�ck�uqN)r[r\r]r�rarbrcr�r��s �����������rbr�F)�totalr�zix_%(column_0_label)s�_NamingSchemaParameter�DEFAULT_NAMING_CONVENTIONc���eZdZUdZdZ				d									dd�Zded<	dd�Zdd�Z								dd	�Z	dd
�Z
dd�Zdd�Zdd
�Z
dd�Zed d��Ze						d!																	d"d��Ze						d!																	d#d��Zej(d�						d$																	d%d��Z		d&							d'd�Z		d&							d'd�Zy)(rXaDA collection of :class:`_schema.Table`
    objects and their associated schema
    constructs.

    Holds a collection of :class:`_schema.Table` objects as well as
    an optional binding to an :class:`_engine.Engine` or
    :class:`_engine.Connection`.  If bound, the :class:`_schema.Table` objects
    in the collection and their columns may participate in implicit SQL
    execution.

    The :class:`_schema.Table` objects themselves are stored in the
    :attr:`_schema.MetaData.tables` dictionary.

    :class:`_schema.MetaData` is a thread-safe object for read operations.
    Construction of new tables within a single :class:`_schema.MetaData`
    object,
    either explicitly or via reflection, may not be completely thread-safe.

    .. seealso::

        :ref:`metadata_describing` - Introduction to database metadata

    r�Nc�l�|�2t|t�s"tjdt	|��d���tj�|_tj||�|_
|r|nt|_|r||_
t�|_i|_t#j$t&�|_y)aCreate a new MetaData object.

        :param schema:
           The default schema to use for the :class:`_schema.Table`,
           :class:`.Sequence`, and potentially other objects associated with
           this :class:`_schema.MetaData`. Defaults to ``None``.

           .. seealso::

                :ref:`schema_metadata_schema_name` - details on how the
                :paramref:`_schema.MetaData.schema` parameter is used.

                :paramref:`_schema.Table.schema`

                :paramref:`.Sequence.schema`

        :param quote_schema:
            Sets the ``quote_schema`` flag for those :class:`_schema.Table`,
            :class:`.Sequence`, and other objects which make usage of the
            local ``schema`` name.

        :param info: Optional data dictionary which will be populated into the
            :attr:`.SchemaItem.info` attribute of this object.

        :param naming_convention: a dictionary referring to values which
          will establish default naming conventions for :class:`.Constraint`
          and :class:`.Index` objects, for those objects which are not given
          a name explicitly.

          The keys of this dictionary may be:

          * a constraint or Index class, e.g. the :class:`.UniqueConstraint`,
            :class:`_schema.ForeignKeyConstraint` class, the :class:`.Index`
            class

          * a string mnemonic for one of the known constraint classes;
            ``"fk"``, ``"pk"``, ``"ix"``, ``"ck"``, ``"uq"`` for foreign key,
            primary key, index, check, and unique constraint, respectively.

          * the string name of a user-defined "token" that can be used
            to define new naming tokens.

          The values associated with each "constraint class" or "constraint
          mnemonic" key are string naming templates, such as
          ``"uq_%(table_name)s_%(column_0_name)s"``,
          which describe how the name should be composed.  The values
          associated with user-defined "token" keys should be callables of the
          form ``fn(constraint, table)``, which accepts the constraint/index
          object and :class:`_schema.Table` as arguments, returning a string
          result.

          The built-in names are as follows, some of which may only be
          available for certain types of constraint:

            * ``%(table_name)s`` - the name of the :class:`_schema.Table`
              object
              associated with the constraint.

            * ``%(referred_table_name)s`` - the name of the
              :class:`_schema.Table`
              object associated with the referencing target of a
              :class:`_schema.ForeignKeyConstraint`.

            * ``%(column_0_name)s`` - the name of the :class:`_schema.Column`
              at
              index position "0" within the constraint.

            * ``%(column_0N_name)s`` - the name of all :class:`_schema.Column`
              objects in order within the constraint, joined without a
              separator.

            * ``%(column_0_N_name)s`` - the name of all
              :class:`_schema.Column`
              objects in order within the constraint, joined with an
              underscore as a separator.

            * ``%(column_0_label)s``, ``%(column_0N_label)s``,
              ``%(column_0_N_label)s`` - the label of either the zeroth
              :class:`_schema.Column` or all :class:`.Columns`, separated with
              or without an underscore

            * ``%(column_0_key)s``, ``%(column_0N_key)s``,
              ``%(column_0_N_key)s`` - the key of either the zeroth
              :class:`_schema.Column` or all :class:`.Columns`, separated with
              or without an underscore

            * ``%(referred_column_0_name)s``, ``%(referred_column_0N_name)s``
              ``%(referred_column_0_N_name)s``,  ``%(referred_column_0_key)s``,
              ``%(referred_column_0N_key)s``, ...  column tokens which
              render the names/keys/labels of columns that are referenced
              by a  :class:`_schema.ForeignKeyConstraint`.

            * ``%(constraint_name)s`` - a special key that refers to the
              existing name given to the constraint.  When this key is
              present, the :class:`.Constraint` object's existing name will be
              replaced with one that is composed from template string that
              uses this token. When this token is present, it is required that
              the :class:`.Constraint` is given an explicit name ahead of time.

            * user-defined: any additional token may be implemented by passing
              it along with a ``fn(constraint, table)`` callable to the
              naming_convention dictionary.

          .. versionadded:: 1.3.0 - added new ``%(column_0N_name)s``,
             ``%(column_0_N_name)s``, and related tokens that produce
             concatenations of names, keys, or labels for all columns referred
             to by a given constraint.

          .. seealso::

                :ref:`constraint_naming_conventions` - for detailed usage
                examples.

        Nz-expected schema argument to be a string, got re)rlr�r2r�r�r4�
FacadeDictr�r+r�rgr��naming_conventionr�r��_schemasr��collections�defaultdictr�r�)r�rgr�r�r�s     rcr�zMetaData.__init__s���r��j���&=��#�#���F�|�n�A�'��
��o�o�'���!�+�+�F�L�A���!�
�*�	
��
��D�I�"%�%��
�/1����#�#�D�)�	
�rbzutil.FacadeDict[str, Table]r�c��y)Nz
MetaData()rar�s rcr�zMetaData.__repr__�s��rbc�V�t|t�s|j}||jvSrk)rlr�ror�)r��table_or_keys  rcrEzMetaData.__contains__�s&���,��,�'�+�+�L��t�{�{�*�*rbc��t||�}|jj||�|r|jj	|�yyrk)rhr��_insert_itemr�rK)r�rfrgrnros     rcr�zMetaData._add_table�s>���T�6�*����� � ��e�,���M�M���f�%�rbc�R�t||�}tj|j|d�}|�"|jD]}|j|��|jrE|jj�D�chc]}|j��|j��c}|_yycc}wrk)	rh�dictr�r�r�rfr�r�rg)r�rfrgro�removedr��ts       rcr�zMetaData._remove_table�s����T�6�*���(�(�4�;�;��T�2�����*�*���(�(��.�+��=�=�"&�+�+�"4�"4�"6��"6�Q�!�(�(�:N����"6��D�M���s�:B$�B$c��|j|j|j|j|j|j
d�S)N)r�rg�schemas�	sequences�fk_memosr�)r�rgr�r�r�r�r�s rc�__getstate__zMetaData.__getstate__�s8���k�k��k�k��}�}�������!%�!7�!7�

�	
rbc�|�|d|_|d|_|d|_|d|_|d|_|d|_y)Nr�rgr�r�r�r�)r�rgr�r�r�r�)r�r�s  rc�__setstate__zMetaData.__setstate__�sJ���H�o����H�o���!&�':�!;�����,����i�(��
��z�*��rbc��tj|j�|jj�|jj�y)z+Clear all Table objects from this MetaData.N)r��clearr�r�r�r�s rcr�zMetaData.clear�s4��	
�
�
�4�;�;���
�
���������rbc�P�|j|j|j�y)z1Remove the given Table object from this MetaData.N)r�rfrgrLs  rcrzMetaData.remove�s��	
���5�:�:�u�|�|�4rbc�t�tjt|jj	�d����S)a�Returns a list of :class:`_schema.Table` objects sorted in order of
        foreign key dependency.

        The sorting will place :class:`_schema.Table`
        objects that have dependencies
        first, before the dependencies themselves, representing the
        order in which they can be created.   To get the order in which
        the tables would be dropped, use the ``reversed()`` Python built-in.

        .. warning::

            The :attr:`.MetaData.sorted_tables` attribute cannot by itself
            accommodate automatic resolution of dependency cycles between
            tables, which are usually caused by mutually dependent foreign key
            constraints. When these cycles are detected, the foreign keys
            of these tables are omitted from consideration in the sort.
            A warning is emitted when this condition occurs, which will be an
            exception raise in a future release.   Tables which are not part
            of the cycle will still be returned in dependency order.

            To resolve these cycles, the
            :paramref:`_schema.ForeignKeyConstraint.use_alter` parameter may be
            applied to those constraints which create a cycle.  Alternatively,
            the :func:`_schema.sort_tables_and_constraints` function will
            automatically return foreign key constraints in a separate
            collection when cycles are detected so that they may be applied
            to a schema separately.

            .. versionchanged:: 1.3.17 - a warning is emitted when
               :attr:`.MetaData.sorted_tables` cannot perform a proper sort
               due to cyclical dependencies.  This will be an exception in a
               future release.  Additionally, the sort will continue to return
               other tables not involved in the cycle in dependency order which
               was not the case previously.

        .. seealso::

            :func:`_schema.sort_tables`

            :func:`_schema.sort_tables_and_constraints`

            :attr:`_schema.MetaData.tables`

            :meth:`_reflection.Inspector.get_table_names`

            :meth:`_reflection.Inspector.get_sorted_table_and_fkc_names`


        c��|jSrkr
)r�s rcr	z(MetaData.sorted_tables.<locals>.<lambda>"s��q�u�urbr
)r�sort_tablesrr�r�r�s rc�
sorted_tableszMetaData.sorted_tables�s-��f����4�;�;�%�%�'�_�=�
�	
rbc��yrkra�	r�rbrg�views�onlyr�r�r�r�s	         rc�reflectzMetaData.reflect'���rbc��yrkrar�s	         rcr�zMetaData.reflect6r�rbzsqlalchemy.engine.reflectionc
��tj|�j�5}	|	|||t�d�}
|
j	|�|�|j
}|�||
d<tjjjj}t
j|	j|��}|rotjjjj}|j	|	j|��	|j	|	j|��|�)t
j|D�
cgc]	}
|�d|
����c}
�}n|}t|j"�}|�%t%||�D�
�cgc]
\}
}|s||vr|
��}}
}n�t'|�r.t%||�D�
�cgc]\}
}|s||vr||
|�r|
��}}
}nq|D�
cgc]	}
|
|vs�|
��}}
|rF|xrd|zxsd}dj)|�}t+j,d|j.�|�d	|�d
���|D�
cgc]
}
|s|
|vr|
��}}
|	j0d||||tjjj2jd�|��}||
d<|D]}
	t5|
|fi|
���	ddd�y#t $rY���wxYwcc}
wcc}}
wcc}}
wcc}
wcc}
w#t*j6$r%}t
j8d
|
�d|���Yd}~�{d}~wwxYw#1swYyxYw)a.Load all available table definitions from the database.

        Automatically creates ``Table`` entries in this ``MetaData`` for any
        table available in the database but not yet present in the
        ``MetaData``.  May be called multiple times to pick up tables recently
        added to the database, however no special action is taken if a table
        in this ``MetaData`` no longer exists in the database.

        :param bind:
          A :class:`.Connection` or :class:`.Engine` used to access the
          database.

        :param schema:
          Optional, query and reflect tables from an alternate schema.
          If None, the schema associated with this :class:`_schema.MetaData`
          is used, if any.

        :param views:
          If True, also reflect views (materialized and plain).

        :param only:
          Optional.  Load only a sub-set of available named tables.  May be
          specified as a sequence of names or a callable.

          If a sequence of names is provided, only those tables will be
          reflected.  An error is raised if a table is requested but not
          available.  Named tables already present in this ``MetaData`` are
          ignored.

          If a callable is provided, it will be used as a boolean predicate to
          filter the list of potential table names.  The callable is called
          with a table name and this ``MetaData`` instance as positional
          arguments and should return a true value for any table to reflect.

        :param extend_existing: Passed along to each :class:`_schema.Table` as
          :paramref:`_schema.Table.extend_existing`.

        :param autoload_replace: Passed along to each :class:`_schema.Table`
          as
          :paramref:`_schema.Table.autoload_replace`.

        :param resolve_fks: if True, reflect :class:`_schema.Table`
         objects linked
         to :class:`_schema.ForeignKey` objects located in each
         :class:`_schema.Table`.
         For :meth:`_schema.MetaData.reflect`,
         this has the effect of reflecting
         related tables that might otherwise not be in the list of tables
         being reflected, for example if the referenced table is in a
         different schema or is omitted via the
         :paramref:`.MetaData.reflect.only` parameter.  When False,
         :class:`_schema.ForeignKey` objects are not followed to the
         :class:`_schema.Table`
         in which they link, however if the related table is also part of the
         list of tables that would be reflected in any case, the
         :class:`_schema.ForeignKey` object will still resolve to its related
         :class:`_schema.Table` after the :meth:`_schema.MetaData.reflect`
         operation is
         complete.   Defaults to True.

         .. versionadded:: 1.3.0

         .. seealso::

            :paramref:`_schema.Table.resolve_fks`

        :param \**dialect_kwargs: Additional keyword arguments not mentioned
         above are dialect specific, and passed in the form
         ``<dialectname>_<argname>``.  See the documentation regarding an
         individual dialect at :ref:`dialect_toplevel` for detail on
         documented arguments.

        .. seealso::

            :ref:`metadata_reflection_toplevel`

            :meth:`_events.DDLEvents.column_reflect` - Event used to customize
            the reflected columns. Usually used to generalize the types using
            :meth:`_types.TypeEngine.as_generic`

            :ref:`metadata_reflection_dbagnostic_types` - describes how to
            reflect tables using general types.

        )r�r�r�r�r�Nrgrez schema '%s'r�r?z7Could not reflect: requested table(s) not available in z: (r�)rg�filter_names�	available�kind�scoper�zSkipping table z: ra)r3rrr�rrgr4r��engine_reflection�
ObjectKind�TABLE�
OrderedSet�get_table_names�ANY�get_view_names�get_materialized_view_namesr�r�rjr�rBr2r��engine�_get_reflection_info�ObjectScoperV�UnreflectableTableErrorrr)r�rbrgr�r�r�r�r�r�r�reflect_optsr�r�rf�available_w_schema�current�schname�load�missing�s�missing_strr��uerrs                       rcr�zMetaData.reflectEsN��F�
�
��
%�
9�
9�
;�t�!%�#2�$4�*�!�e�!�L�
����/��~������!�)/��X�&��>�>�3�3�>�>�D�D�D�.2�o�o��$�$�V�,�/�I���~�~�7�7�B�B�F�F��� � ��!4�!4�V�!<�=���$�$�T�%E�%E�f�%M�N��!�;?�?�?�4=�>�I�D��x�q���'�I�>�<�"�&/�"��$�+�+�&�G��|�*-�Y�8J�)K��)K�
��g�&�'��*@��)K���
�$��*-�Y�8J�)K��)K�
��g�'�7�'�+A��T�4�(��)K���-1�J�D�D�D�	�4I�4�D��J���<�N�V�$;�B��A�"&�)�)�G�"4�K��1�1��"�k�k�_�Q�C�s�;�-�q�B���!%�� $��&�$�g�*=�� $���6�D�5�5���!�#���n�n�6�6�B�B�F�F��!�
�M�-:�L��)���@��$��5��5��[<�
;��4+�����
?������K����(�2�2�@��I�I���v�R��v�>�?�?��@��a<�
;�s��CK?�> J�K?�3J)
�0K?�1J.�K?�!J4�<K?�	J:�J:�AK?� J?�/AK?�
K�
K?�	J&�"K?�%J&�&K?�K<�K7�2K?�7K<�<K?�?Lc�J�|jtj|||��y)aDCreate all tables stored in this metadata.

        Conditional by default, will not attempt to recreate tables already
        present in the target database.

        :param bind:
          A :class:`.Connection` or :class:`.Engine` used to access the
          database.

        :param tables:
          Optional list of ``Table`` objects, which is a subset of the total
          tables in the ``MetaData`` (others are ignored).

        :param checkfirst:
          Defaults to True, don't issue CREATEs for tables already present
          in the target database.

        �r]r�Nr^�r�rbr�r]s    rc�
create_allzMetaData.create_all�s&��0	
�������*�V�	�	
rbc�J�|jtj|||��y)a?Drop all tables stored in this metadata.

        Conditional by default, will not attempt to drop tables not present in
        the target database.

        :param bind:
          A :class:`.Connection` or :class:`.Engine` used to access the
          database.

        :param tables:
          Optional list of ``Table`` objects, which is a subset of the
          total tables in the ``MetaData`` (others are ignored).

        :param checkfirst:
          Defaults to True, only issue DROPs for tables confirmed to be
          present in the target database.

        r�Nrer�s    rc�drop_allzMetaData.drop_alls&��0	
������t�
�6�	�	
rb)NNNN)
rgr�r�r�r�z Optional[_NamingSchemaParameter]r�rrvr�r�)r�zUnion[str, Table]rvr�)rfr�rgr�rnrVrvr�)rfr�rgr�rvr�)rv�Dict[str, Any])r�r�rvr�r�r�)rvzList[Table])......)rbrJrgr�r�r�r��CUnion[_typing_Sequence[str], Callable[[str, MetaData], bool], None]r�r�r�r�r�r�r�rrvr�)rbrIrgr�r�r�r�r�r�r�r�r�r�r�r�rrvr�)NFNFTT)rbr�rgr�r�r�r�r�r�r�r�r�r�r�r�rrvr�)NT)rbr�r�z!Optional[_typing_Sequence[Table]]r]r�rvr�)r[r\r]r�r�r�r�r�rEr�r�r�r�r�rr�r�rr�r4r�r�r�rarbrcrXrX�s����0 �N�!%�'+�>B�$(�K
��K
�%�K
�<�	K
�
"�K
�
�
K
�Z
(�'��"�+�
&��&�!.�&�7<�&�	
�&�	�
�+��5�
�4
��4
�p�!$��
� #�!$��������	�

����������
�����!$��
� #�!$��������	�

����������
�����T���7�8�!%��
� %�!%� �s@�'�s@��s@��	s@�

�s@��s@��s@��s@��s@�
�s@�9�s@�p59��	
��
�2�
��	
�

�
�>59��	
��
�2�
��	
�

�
rbrXc��eZdZUdZdZded<eddd�	d					dd	��Zdd
�Zdd�Z	e
jdd
�dd�					dd��Zdd�					dd�Z
y)r�a3Defines a generated column, i.e. "GENERATED ALWAYS AS" syntax.

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

        from sqlalchemy import Computed

        Table(
            "square",
            metadata_obj,
            Column("side", Float, nullable=False),
            Column("area", Float, Computed("side * side")),
        )

    See the linked documentation below for complete details.

    .. versionadded:: 1.3.11

    .. seealso::

        :ref:`computed_ddl`

    �computed_columnr�rPrXz:class:`.Computed`z:paramref:`.Computed.sqltext`Nc�r�tjtj|�|_||_d|_y)aConstruct a GENERATED ALWAYS AS DDL construct to accompany a
        :class:`_schema.Column`.

        :param sqltext:
          A string containing the column generation expression, which will be
          used verbatim, or a SQL expression construct, such as a
          :func:`_expression.text`
          object.   If given as a string, the object is converted to a
          :func:`_expression.text` object.

        :param persisted:
          Optional, controls how this column should be persisted by the
          database.   Possible values are:

          * ``None``, the default, it will use the default persistence
            defined by the database.
          * ``True``, will render ``GENERATED ALWAYS AS ... STORED``, or the
            equivalent for the target database if supported.
          * ``False``, will render ``GENERATED ALWAYS AS ... VIRTUAL``, or
            the equivalent for the target database if supported.

          Specifying ``True`` or ``False`` may raise an error when the DDL
          is emitted to the target database if the database does not support
          that persistence option.   Leaving this parameter at its default
          of ``None`` is guaranteed to succeed for all databases that support
          ``GENERATED ALWAYS AS``.

        N)rrrrZrX�	persistedrP)r�rXr�s   rcr�zComputed.__init__Qs-��D!�'�'��(?�(?��I���"�����rbc�F�t|t�sJ�t|jtd�tf�r%t|j
td�tf�st
jd��||_||_	||j_||j_y)NzPA generated column cannot specify a server_default or a server_onupdate argument)
rlrmr'r�r�r�r2r�rPr�ras   rcrZzComputed._set_parentws����&�&�)�)�)���!�!�D��J��#9�
��F�2�2�T�$�Z��4J�K��#�#�+��
�������&*����#�%)����"rbc��|Srkrar}s  rcr�zComputed._as_for_update�����rbr�z_The :meth:`_schema.Computed.copy` method is deprecated and will be removed in a future release.rFc�*�|jdd|i|��SrHr�rIs   rcr�z
Computed.copy�r_rbc���t|j|j�|jjnd|�}t	||j
��}|j
|�S)N)r�)r{rXrPrnr�r�r�)r�rzrrrX�gs     rcrtzComputed._copy�sS��#��L�L�!%���!8�D�K�K���d��
��

�W����7���%�%�a�(�(rbrk)rXr=r�r�rvr�r�r�)rzrTrrrrvr�)r[r\r]r�r�r�r'r�rZr�r4r�r�rtrarbrcr�r�4s����0'�N�!�!���'�)H��HL�!�)�!�6D�!�	
�!��!�F
*���T�_�_�
�	3��26�;�.�;�=@�;�	�;��
;�26�
)�.�
)�=@�
)�	�
)rbr�c��eZdZdZdZdZ											d																							d
d�Zdd�Zdd�Ze	jdd	�dd
��Zdd�Zy)r�a4Defines 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",
            metadata_obj,
            Column("id", Integer, Identity()),
            Column("description", Text),
        )

    See the linked documentation below for complete details.

    .. versionadded:: 1.4

    .. seealso::

        :ref:`identity_ddl`

    �identity_columnTNc�l�tj||||||||	|
|��
||_||_d|_y)aqConstruct a GENERATED { ALWAYS | BY DEFAULT } AS IDENTITY DDL
        construct to accompany a :class:`_schema.Column`.

        See the :class:`.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.

        :param 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.

        :param 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 Database.

        :param start: the starting index of the sequence.
        :param increment: the increment value of the sequence.
        :param minvalue: the minimum value of the sequence.
        :param maxvalue: the maximum value of the sequence.
        :param nominvalue: no minimum value of the sequence.
        :param nomaxvalue: no maximum value of the sequence.
        :param cycle: allows the sequence to wrap around when the maxvalue
         or minvalue has been reached.
        :param cache: optional integer value; number of future values in the
         sequence which are calculated in advance.
        :param order: optional boolean value; if true, renders the
         ORDER keyword.

        r�N)r�r��always�on_nullrP)r�rrr�r�r�r�r�r�r�r�r�s            rcr�zIdentity.__init__�sM��v	� � ������!�!����	!�	
���������rbc�|�t|t�sJ�t|jtd�tf�rt|j
td��st
jd��|jdurt
jd��||_	||_
|jturd|_
||_y)Nz^A column with an Identity object cannot specify a server_default or a server_onupdate argumentFzCA column with an Identity object cannot specify autoincrement=False)rlrmr'r�r�r�r2r�r�rPr$r�r`r(ras   rcrZzIdentity._set_parent	s����&�&�)�)�)���!�!�D��J��#9�
��F�2�2�D��J�?��#�#�?��
����5�(��#�#�&��
��������(�(�,<�<�#�F�O� $��rbc��|Srkrar}s  rcr�zIdentity._as_for_updaterrbr�z_The :meth:`_schema.Identity.copy` method is deprecated and will be removed in a future release.c�&�|jdi|��Sr�r�r�s  rcr�z
Identity.copy"r�rbc
�,�t|j|j|j|j|j
|j|j|j|j|j|j��}|j|�S)N)rrr�r�r�r�r�r�r�r�r�)
r�rrr�r�r�r�r�r�r�r�r�r�)r�rr�is   rcrtzIdentity._copy*sl����;�;��L�L��*�*��n�n��]�]��]�]��������*�*��*�*��*�*�
���%�%�a�(�(rb)FNNNNNNNNNN)rr�rr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rvr�r�r�)rrrrvr�)
r[r\r]r�r�r�r�rZr�r4r�r�rtrarbrcr�r��s����2'�N��K��"&�#�#'�"&�"&�%)�%)� $�#� $�I��I� �I��	I�
!�I� �
I� �I�#�I�#�I��I��I��I�
�I�V%�,��T�_�_�
�	3��
 ��
 �)rbr�)rfr�rgr�rvr�)rxr�ryrTrzrTrvr�r)
rfr�r�rr~r�r#r�rvr)rp�Optional[DefaultGenerator]rvzTypeGuard[Sequence])rprrvz%TypeGuard[ColumnElementColumnDefault])rprrvz%TypeGuard[ScalarElementColumnDefault])�r��
__future__r�abcrr��enumr�operatorr�rrrr	r
rrr
rrrrrr�rrrrrr�rrrrr�baserrr r!r"r#r$r%r&r'rdr(r)r*r+r,rr-r.r/r1r2r3r4r5�util.typingr6r7r8r9r:r;�_typingr<r=r>r?r@rArBrrCrDrE�	functionsrFrGrHr�rIrJ�engine.interfacesrKrLrM�engine.mockrN�engine.reflectionrO�sql.selectablerPrQrSrUr�r�ri�_ServerDefaultArgument�_ServerOnUpdateArgumentrYr^r�r_r`rhr{�_self_inspects�	VisitablerTr�r��InspectablerVrmr�rr,rrru�
attrgetterrzr�r�r&r�r�r�r�r�rWr�rrr@rVrur�r�ry�_NamingSchemaCallabler�r�r��
immutabledictr�rXr�r�rarbrc�<module>r#sC���.#�����
�������������/��� ��������*���1�2�(���8�.�#�"�#�!� �#�!�+�������!�"��#�#�	���+�+�"�7�,��.�%�'�,�#�$�"�#��;�?�4�,�3�+��T����
�e�<�(���v�W�%���@�A��"�5��i��#8�9����C��]�3�%7�7���1���$��F����8�����
�6��� � ��>��
#��"��!��"���	�:���*�"�H�$6�$6�*��*�Z0�0�f�J��Y-��=�+�z�/E�/E�g�/N�Y-�x$s�]�J��R�(8�s�n%�/3�/�"�!%�/�
�/�,�/��	/�
�/��
/�dn-��
�n-�b�"�
'�"�	�"�4�
'�4�	.�4�4�
'�4�	.�4�
.�(�-�-�m�<�� 3�� 3� 3�4G� H��+��+�+�K�8��<
�z�:�<
�~R:�$�c�R:�j
��
�(#.�=�#.�L�:�;��@��@�@>�X�>�1�M�1�h6A�6A�r\
�}�o�/?�\
�~���9'�$�9'��9'�x)P�L�)P�Xp$�� 1�:�p$�fQ'�Q'�hy"�!6�
�y"�xl)�0�l)�^j+�5�j+�Z	i�5�i�X	)�1�	)�S
��(�*;�Z�S
�l!�*�e�!4�c�!9�:���s�$9�9�:���i�u�����C�'�'�(�	*���5G�D�4F�4F�	�"�#�5��1��
v
�}�v
�ri)�|�Z�i)�XY)���j�Y)rb

ZeroDay Forums Mini