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Z� ddxlHm�Z� ddylHm�Z� ddzlHm�Z� dd{l�m�Z� dd|l�m�Z� dd}l�m�Z� dd~lVm�Z� ddl#m�Z� dd�l$m�Z� ed�eOe d�f Z�eed� gee� f Z� G d�� d�e`� � Z�ed�e�f Z�ed�e�f Z�eed� ed� f Z�ee�ee� ed� e
e�e f f Z�eed� Z� G d�� d�eJe� � � Z� G d�� d�e!j� eP� � Z� G d�� d�eBe�� � Z� G d�� d�e�ee( � � Z� G d�� d�e�� � Z� G d�� d�� � Z� G d�� d�� � Z� G d�� d�� � Z� G d�� d�e!j� e�� � Z� G d�� d�e�� � Z� G d�� d�e� � Z� e�e�� � \ Z�Z�Z�Z�e�Z� G d�� d�e!j� e�� � Z� G d�� d�� � Z� G d�� d�e�� � Z� G d�� d�e�e�� � Z� G d�� d�e�� � Z� G d�� d�e!j� e�� � Z� G d�� d�e�e�� � Z� G d�� d�e�e�� � Z� G d�� d�e�� � Z� G d�� d�e!j� e!j� eCe�e�e�� � Z� G d�� d�e� � Z� G d�� d�e� � Z� G d�� d�e�� � Z� G d�� d�e!j� e�� � Z� G d�� d�e�� � Z� G d�� d�eQe�� � Z� G d�� d�e�e�� � Z� G d�� d�e!j� eFe�� � Z�ed�de�e
e�e f f Z� G dÄ d�eL� � Z� G dĄ d�e!j� eCe�� � Z� G dƄ d�e!j� eQeOe � � Z� G dȄ d�e!j� e!j� e!j� e!j� e�e0e�� � Z� ed�eʬZ� � Z� G d˄ d�eQe�ee� � � Z� G d̈́ d�e�eC� � Z� e@j� d�dЦ � G dф d�e@� � � � Z� G dӄ d�e� � Z� G dՄ d�eDe�e�� � Z�e�D ]Z� e�e�e�j� eҦ � � e@j� d�dצ � G d d�e\j� e@� � � � Z� G dڄ dۦ � Z� G d܄ d�ej� e"j� e$j� � � Z� G dބ d�e�e�e�eDe�e�e�e( � � Z� G d�� d�e!j� eCeQeOec � � Z� G d� d�eTe� � � Z� G d� d�e�e�eC� � Z�e�Z� G d� d�e/� � Z�dS )�ztThe :class:`_expression.FromClause` class of SQL expression elements,
representing
SQL tables and derived rowsets.
� )�annotationsN)�Enum)�AbstractSet)�Any)�Callable)�cast)�Dict)�Generic)�Iterable)�Iterator)�List)�
NamedTuple)�NoReturn)�Optional)�overload)�Sequence)�Set)�Tuple)�Type)�
TYPE_CHECKING)�TypeVar)�Union� )� cache_key)� coercions)� operators)�roles)�
traversals)�type_api)�visitors)�_ColumnsClauseArgument)�_no_kw)�_TP��is_column_element)�is_select_statement)�is_subquery)�is_table)�is_text_clause)� Annotated)�SupportsCloneAnnotations)�_clone)�_cloned_difference��_cloned_intersection��_entity_namespace_key)�_EntityNamespace)�_expand_cloned��
_from_objects)�_generative��_never_select_column)�_NoArg)�_select_iterables)�CacheableOptions)�ColumnCollection)� ColumnSet)�CompileState)�DedupeColumnCollection)�
Executable)�
Generative)�HasCompileState)�HasMemoized)� Immutable)�_document_text_coercion)�_anonymous_label)�
BindParameter)�BooleanClauseList)�
ClauseElement)�
ClauseList)�ColumnClause)�
ColumnElement)�DQLDMLClauseElement)�GroupedElement)�literal_column)�TableValuedColumn)�UnaryExpression)�OperatorType)�NULLTYPE)�_TraverseInternalsType)�InternalTraversal)�prefix_anon_map� )�exc)�util)�!HasMemoized_ro_memoized_attribute)�Literal)�Protocol)�Self�_T)�bound)�_ColumnExpressionArgument)�#_ColumnExpressionOrStrLabelArgument)�_FromClauseArgument)�_JoinTargetArgument)�_LimitOffsetType)�
_MAYBE_ENTITY)�_NOT_ENTITY)�_OnClauseArgument)�#_SelectStatementForCompoundArgument)�_T0)�_T1)�_T2)�_T3)�_T4)�_T5)�_T6)�_T7)�_TextCoercedExpressionArgument)�_TypedColumnClauseArgument)�_TypeEngineArgument)�_AmbiguousTableNameMap)�ExecutableOption)�ReadOnlyColumnCollection)�_CacheKeyTraversalType)�SQLCompiler)�Delete)�Update)�BinaryExpression)�KeyedColumnElement)�Label)�NamedColumn)�
TextClause)�Function)�
ForeignKey)�ForeignKeyConstraint)�TableValueType)�
TypeEngine)�_CloneCallableType�
FromClauser )�ColumnElement[Any]r c �R � e Zd Zej dd�� � Zej dd�� � ZdS ) �_JoinTargetProtocol�return�List[FromClause]c � � d S �N� ��selfs �i/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/sqlalchemy/sql/selectable.pyr5 z!_JoinTargetProtocol._from_objects� s � �14�� r2 c � � d S r� r� r� s r� �entity_namespacez$_JoinTargetProtocol.entity_namespace� s � �47�Cr� N�r� r� �r� r2 )�__name__�
__module__�__qualname__rY �ro_non_memoized_propertyr5 r� r� r� r� r� r� � sD � � � � � � �"�4�4�4� #�"�4� �"�7�7�7� #�"�7�7�7r� r� �ColumnElement[bool])�_ColumnExpressionArgument[Any]rb r� c �* � e Zd ZdZedd�� � ZdS )�_OffsetLimitParamTr� �
Optional[int]c � � | j S r� )�effective_valuer� s r� �_limit_offset_valuez%_OffsetLimitParam._limit_offset_value� s � ��#�#r� N�r� r� )r� r� r� �
inherit_cache�propertyr� r� r� r� r� r� � s7 � � � � � ��M�
�$� $� $� �X�$� $� $r� r� c � � e Zd ZdZdZdZdZdZdZe dd�� � Z
ej dd�� � Z
dd�Zdd�Zdd�Ze d d�� � ZdS )!�ReturnsRowsa� The base-most class for Core constructs that have some concept of
columns that can represent rows.
While the SELECT statement and TABLE are the primary things we think
of in this category, DML like INSERT, UPDATE and DELETE can also specify
RETURNING which means they can be used in CTEs and other forms, and
PostgreSQL has functions that return rows also.
.. versionadded:: 1.4
TFr� c � � | S r� r� r� s r� �
selectablezReturnsRows.selectable� s � ��r� �_SelectIterablec � � t � � �)aE A sequence of column expression objects that represents the
"selected" columns of this :class:`_expression.ReturnsRows`.
This is typically equivalent to .exported_columns except it is
delivered in the form of a straight sequence and not keyed
:class:`_expression.ColumnCollection`.
��NotImplementedErrorr� s r� �_all_selected_columnsz!ReturnsRows._all_selected_columns� s � � "�#�#�#r� �
fromclause�Optional[FromClause]�boolc � � t � � �)z�Return ``True`` if this :class:`.ReturnsRows` is
'derived' from the given :class:`.FromClause`.
An example would be an Alias of a Table is derived from that Table.
r� �r� r� s r� �is_derived_fromzReturnsRows.is_derived_from� � � � "�#�#�#r� r� �columns�.ColumnCollection[str, KeyedColumnElement[Any]]�primary_keyr= �foreign_keys�Set[KeyedColumnElement[Any]]�Nonec � � t � � �)z=Populate columns into an :class:`.AliasedReturnsRows` object.r� �r� r� r� r� r� s r� �#_generate_fromclause_column_proxiesz/ReturnsRows._generate_fromclause_column_proxies� s � � "�#�#�#r� �columnr� c � � t � � �)z>reset internal collections for an incoming column being added.r� �r� r� s r� �_refresh_for_new_columnz#ReturnsRows._refresh_for_new_column� s � �!�#�#�#r� �"ReadOnlyColumnCollection[Any, Any]c � � t � � �)a A :class:`_expression.ColumnCollection`
that represents the "exported"
columns of this :class:`_expression.ReturnsRows`.
The "exported" columns represent the collection of
:class:`_expression.ColumnElement`
expressions that are rendered by this SQL
construct. There are primary varieties which are the
"FROM clause columns" of a FROM clause, such as a table, join,
or subquery, the "SELECTed columns", which are the columns in
the "columns clause" of a SELECT statement, and the RETURNING
columns in a DML statement..
.. versionadded:: 1.4
.. seealso::
:attr:`_expression.FromClause.exported_columns`
:attr:`_expression.SelectBase.exported_columns`
r� r� s r� �exported_columnszReturnsRows.exported_columns s � �0 "�#�#�#r� N�r� r� �r� r� �r� r� r� r� �
r� r� r� r� r� r= r� r� r� r� �r� r� r� r� )r� r� )r� r� r� �__doc__�_is_returns_rows�_is_from_clause�_is_select_base�_is_select_statement�_is_lateralr� r� rY r� r� r� r� r� r� r� r� r� r� r� � s� � � � � � �
�
� �� �O��O� ���K�
�� � � �X��
�"� $� $� $� #�"� $�$� $� $� $� $� $� $� $�$� $� $� $� �$� $� $� �X�$� $� $r� r� c � � e Zd ZdZdS )�ExecutableReturnsRows�0base for executable statements that return rows.N�r� r� r� r� r� r� r� r� r� � � � � � � �:�:�:�:r� r� c � � e Zd ZdZdS )�TypedReturnsRowsr� Nr� r� r� r� r� r� r� r� r� c � � e Zd ZdZdZdZdd�Zdd d
�Z ej dd�� � ej
d� � d!d�� � � � Z d"d#d�Zd S )$�
Selectablez!Mark a class as being selectable.r� Tr� r� r� r� c � � t � � �r� r� r� s r� r� z"Selectable._refresh_for_new_column+ � � �!�#�#�#r� N�name�
Optional[str]�LateralFromClausec �: � t � | |�� � S )�; Return a LATERAL alias of this :class:`_expression.Selectable`.
The return value is the :class:`_expression.Lateral` construct also
provided by the top-level :func:`_expression.lateral` function.
.. seealso::
:ref:`tutorial_lateral_correlation` - overview of usage.
�r� )�Lateral�
_construct�r� r� s r� �lateralzSelectable.lateral. s � � �!�!�$�T�!�2�2�2r� �1.4z�The :meth:`.Selectable.replace_selectable` method is deprecated, and will be removed in a future release. Similar functionality is available via the sqlalchemy.sql.visitors module.)�message�sqlalchemy.sql.util�oldr� �alias�Aliasr] c �p � t j j � |� � � | � � S )z�Replace all occurrences of :class:`_expression.FromClause`
'old' with the given :class:`_expression.Alias`
object, returning a copy of this :class:`_expression.FromClause`.
)rY � preloaded�sql_util�
ClauseAdapter�traverse)r� r� r� s r� �replace_selectablezSelectable.replace_selectable; s+ � � �~�&�4�4�U�;�;�D�D�T�J�J�Jr� F�KeyedColumnElement[Any]�require_embeddedr� �!Optional[KeyedColumnElement[Any]]c �8 � | j � ||� � S )a� Given a :class:`_expression.ColumnElement`, return the exported
:class:`_expression.ColumnElement` object from the
:attr:`_expression.Selectable.exported_columns`
collection of this :class:`_expression.Selectable`
which corresponds to that
original :class:`_expression.ColumnElement` via a common ancestor
column.
:param column: the target :class:`_expression.ColumnElement`
to be matched.
:param require_embedded: only return corresponding columns for
the given :class:`_expression.ColumnElement`, if the given
:class:`_expression.ColumnElement`
is actually present within a sub-element
of this :class:`_expression.Selectable`.
Normally the column will match if
it merely shares a common ancestor with one of the exported
columns of this :class:`_expression.Selectable`.
.. seealso::
:attr:`_expression.Selectable.exported_columns` - the
:class:`_expression.ColumnCollection`
that is used for the operation.
:meth:`_expression.ColumnCollection.corresponding_column`
- implementation
method.
)r� �corresponding_column)r� r� r� s r� r� zSelectable.corresponding_columnJ s&