XylotrechusZ
�
Ȓ�gֻ � �" � d Z ddlmZ ddlmZ ddlZddlmZ ddlZddlm Z ddlm
Z
ddlmZ dd lmZ dd
lm
Z
ddlmZ ddlmZ dd
lmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddl m!Z! ddl m"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'l+m0Z0 dd(l+m1Z1 dd)l+m2Z2 dd*l+m3Z3 dd+l+m4Z4 dd,l+m5Z5 dd-l+m6Z6 dd.l+m7Z7 dd/l+m8Z8 dd0l9m:Z: dd1l;m<Z< dd2l;m=Z= dd3l;m>Z> dd4l;m?Z? dd5l;m@Z@ dd6l;mAZA dd7l;mBZB dd8lmCZC d9d:lmDZD d9d;lmEZE d9d<lFmGZG d9d=lFmHZH ej, r`dd>lmIZI dd?lmJZJ dd@lmKZK ddAl+mLZL ddBl+mMZM ddCl;mNZN ddDl;mOZO ddEl;mPZP ddFlmQZQ ddGlmRZR ddHlmSZS d9dIlTmUZU d9dJlTmVZV d9dKlTmWZW d9dLlTmXZX d9dMlYmZZZ edNdO�P� Z[ d| d}dQ�Z\ d~dR�Z] ddS�Z^ d�dT�Z_ d�dU�Z`dVdVdVdVdVdW� d�dX�Zad�dY�ZbdZ� Zcd[� Zdd\� Zed�d]�Zfd^� Zgd_� Zhd`� Zid�da�Zjdb� Zkdc� Zl G dd� de� Zmdf� Zn G dg� dhem� Zo G di� djep� Zq G dk� dlem� Zrd�dm�Zs d� d�dn�Zte d�do�� Zue d�dp�� Zu d�dq�Zu d�dr�Zv G ds� dtej� � Zx G du� dveH� Zy G dw� dxex� Zz d| d�dy�Z{ d�dz�Z| d�d{�Z}y)�z;High level utilities which build upon other modules here.
� )�annotations)�dequeN)�chain)�AbstractSet)�Any)�Callable)�cast)�
Collection)�Dict)�Iterable)�Iterator)�List)�Optional)�overload)�Sequence)�Tuple)�
TYPE_CHECKING)�TypeVar)�Union� )� coercions)� operators)�roles)�visitors��is_text_clause)�_deep_annotate)�_deep_deannotate)�_shallow_annotate)�_expand_cloned)�
_from_objects)�HasCacheKey)�sort_tables)�
_find_columns)�_label_reference)�_textual_label_reference)�
BindParameter)�
ClauseElement)�ColumnClause)�
ColumnElement)�Grouping)�KeyedColumnElement)�Label)�NamedColumn)�Null)�UnaryExpression)�Column)�Alias)�
FromClause)�FromGrouping)�Join)�ScalarSelect)�
SelectBase)�TableClause)�_ET� )�exc)�util)�Literal)�Protocol)�_EquivalentColumnMap)�_LimitOffsetType)�_TypeEngineArgument)�BinaryExpression)�
TextClause)�_JoinTargetElement)�_SelectIterable)�
Selectable)�_TraverseCallableType)�ExternallyTraversible)�ExternalTraversal)�_AnyExecuteParams)�_AnyMultiExecuteParams)�_AnySingleExecuteParams)�_CoreSingleExecuteParams)�Row�_CE�ColumnElement[Any])�boundc �4 � t j | |||�� S )a Create a join condition between two tables or selectables.
e.g.::
join_condition(tablea, tableb)
would produce an expression along the lines of::
tablea.c.id == tableb.c.tablea_id
The join is determined based on the foreign key relationships
between the two selectables. If there are multiple ways
to join, or no way to join, an error is raised.
:param a_subset: An optional expression that is a sub-component
of ``a``. An attempt will be made to join to just this sub-component
first before looking at the full ``a`` construct, and if found
will be successful even if there are other ways to join to ``a``.
This allows the "right side" of a join to be passed thereby
providing a "natural join".
)�a_subset�consider_as_foreign_keys)r5 �_join_condition)�a�brS rT s �D/opt/hc_python/lib64/python3.12/site-packages/sqlalchemy/sql/util.py�join_conditionrY _ s# � �8 ��� � ��!9� � � c � � t t |� � }g }t | � D ]/ \ }}|D ]% }|j |� s�|j |� �' �1 |S )a� Given a list of FROM clauses and a selectable,
return the first index and element from the list of
clauses which can be joined against the selectable. returns
None, None if no match is found.
e.g.::
clause1 = table1.join(table2)
clause2 = table4.join(table5)
join_to = table2.join(table3)
find_join_source([clause1, clause2], join_to) == clause1
)�listr! � enumerate�is_derived_from�append)�clauses�join_to�selectables�idx�i�f�ss rX �find_join_sourcerg � sU � �&