
    ,hO                       S SK Jr  S SKJr  S SKJr  S SKJr  S SKJr  S SKJr  S SKJr  SS	K	J
r
  SS
K	Jr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  \(       ax  SSKJr  SSKJr  SSKJ r   SSKJ!r!  SSKJ"r"  SSKJ#r#  SS KJ$r$  SS!KJ%r%  SS"KJ&r&  SS#KJ'r'  SS$KJ(r(  SS%KJ)r)  SS&KJ*r*  SS'KJ+r+  SS(KJ,r-  SS)K.J/r/  SS*KJ0r0  SS+KJ1r1  SS,KJ2r2  SS-KJ3r3   SY       SZS0 jjr4 SY       S[S1 jjr5\S2   r6\    S\S3 j5       r7\    S]S4 j5       r7    S]S5 jr7\    S\S6 j5       r8\    S]S7 j5       r8    S]S8 jr8 S^   S_S9 jjr9\    S\S: j5       r:\    S]S; j5       r:    S]S< jr:\    S\S= j5       r;\    S]S> j5       r;    S]S? jr;   S`           SaS@ jjr< S^     SbSA jjr=  SY         ScSB jjr>\SdSC j5       r?\      SeSD j5       r?\        SfSE j5       r?\          SgSF j5       r?\            ShSG j5       r?\              SiSH j5       r?\                SjSI j5       r?\                  SkSJ j5       r?\                    SlSK j5       r?\                      SmSL j5       r?\      SnSM j5       r?SnSN jr?SoSO jr@  Sp         SqSP jjrA\    S\SQ j5       rB\    S]SR j5       rB    S]SS jrB\    S\ST j5       rC\    S]SU j5       rC    S]SV jrCS.S/SW.       SrSX jjrDg.)s    )annotations)Any)Optional)overload)Tuple)TYPE_CHECKING)Union   )	coercions)roles)_ColumnsClauseArgument)_no_kw)ColumnClause)Alias)CompoundSelectExists)
FromClauseJoin)Lateral)LateralFromClause)NamedFromClause)SelectTableClause)TableSampleValues)_FromClauseArgument)_OnClauseArgument)#_SelectStatementForCompoundArgument)_T0)_T1)_T2)_T3)_T4)_T5)_T6)_T7)_T8)_T9)_TP)_TypedColumnClauseArgument)Function)CTE)HasCTE)ScalarSelect)
SelectBaseNFc                ,    [         R                  " XUS9$ )a  Return a named alias of the given :class:`.FromClause`.

For :class:`.Table` and :class:`.Join` objects, the return type is the
:class:`_expression.Alias` object. Other kinds of :class:`.NamedFromClause`
objects may be returned for other kinds of :class:`.FromClause` objects.

The named alias represents any :class:`_expression.FromClause` with an
alternate name assigned within SQL, typically using the ``AS`` clause when
generated, e.g. ``SELECT * FROM table AS aliasname``.

Equivalent functionality is available via the
:meth:`_expression.FromClause.alias`
method available on all :class:`_expression.FromClause` objects.

:param selectable: any :class:`_expression.FromClause` subclass,
    such as a table, select statement, etc.

:param name: string name to be assigned as the alias.
    If ``None``, a name will be deterministically generated at compile
    time. Deterministic means the name is guaranteed to be unique against
    other constructs used in the same statement, and will also be the same
    name for each successive compilation of the same statement object.

:param flat: Will be passed through to if the given selectable
 is an instance of :class:`_expression.Join` - see
 :meth:`_expression.Join.alias` for details.

)nameflat)r   _factory)
selectabler5   r6   s      _/var/www/auris/envauris/lib/python3.13/site-packages/sqlalchemy/sql/_selectable_constructors.pyaliasr:   :   s    > >>*d;;    c                f    [         R                  " [        R                  U 5      R	                  XS9$ )zReturn a new :class:`_expression.CTE`,
or Common Table Expression instance.

Please see :meth:`_expression.HasCTE.cte` for detail on CTE usage.

)r5   	recursive)r   expectr   
HasCTERolecte)r8   r5   r=   s      r9   r@   r@   \   s2     E,,j9== >  r;   )zSelect[_TP]CompoundSelect[_TP]c                     g N selectss    r9   except_rG   q        r;   c                     g rC   rD   rE   s    r9   rG   rG   w   rH   r;   c                 (    [         R                  " U 6 $ )zReturn an ``EXCEPT`` of multiple selectables.

The returned object is an instance of
:class:`_expression.CompoundSelect`.

:param \*selects:
  a list of :class:`_expression.Select` instances.

)r   _create_exceptrE   s    r9   rG   rG   }   s     (('22r;   c                     g rC   rD   rE   s    r9   
except_allrM      rH   r;   c                     g rC   rD   rE   s    r9   rM   rM      rH   r;   c                 (    [         R                  " U 6 $ )zReturn an ``EXCEPT ALL`` of multiple selectables.

The returned object is an instance of
:class:`_expression.CompoundSelect`.

:param \*selects:
  a list of :class:`_expression.Select` instances.

)r   _create_except_allrE   s    r9   rM   rM      s     ,,g66r;   c                    [        U 5      $ )a:  Construct a new :class:`_expression.Exists` construct.

The :func:`_sql.exists` can be invoked by itself to produce an
:class:`_sql.Exists` construct, which will accept simple WHERE
criteria::

    exists_criteria = exists().where(table1.c.col1 == table2.c.col2)

However, for greater flexibility in constructing the SELECT, an
existing :class:`_sql.Select` construct may be converted to an
:class:`_sql.Exists`, most conveniently by making use of the
:meth:`_sql.SelectBase.exists` method::

    exists_criteria = (
        select(table2.c.col2).where(table1.c.col1 == table2.c.col2).exists()
    )

The EXISTS criteria is then used inside of an enclosing SELECT::

    stmt = select(table1.c.col1).where(exists_criteria)

The above statement will then be of the form:

.. sourcecode:: sql

    SELECT col1 FROM table1 WHERE EXISTS
    (SELECT table2.col2 FROM table2 WHERE table2.col2 = table1.col1)

.. seealso::

    :ref:`tutorial_exists` - in the :term:`2.0 style` tutorial.

    :meth:`_sql.SelectBase.exists` - method to transform a ``SELECT`` to an
    ``EXISTS`` clause.

r   )
__arguments    r9   existsrS      s    T *r;   c                     g rC   rD   rE   s    r9   	intersectrU      rH   r;   c                     g rC   rD   rE   s    r9   rU   rU      rH   r;   c                 (    [         R                  " U 6 $ )zReturn an ``INTERSECT`` of multiple selectables.

The returned object is an instance of
:class:`_expression.CompoundSelect`.

:param \*selects:
  a list of :class:`_expression.Select` instances.

)r   _create_intersectrE   s    r9   rU   rU      s     ++W55r;   c                     g rC   rD   rE   s    r9   intersect_allrZ      rH   r;   c                     g rC   rD   rE   s    r9   rZ   rZ      rH   r;   c                 (    [         R                  " U 6 $ )zReturn an ``INTERSECT ALL`` of multiple selectables.

The returned object is an instance of
:class:`_expression.CompoundSelect`.

:param \*selects:
  a list of :class:`_expression.Select` instances.


)r   _create_intersect_allrE   s    r9   rZ   rZ      s     //99r;   c                    [        XX#U5      $ )a;  Produce a :class:`_expression.Join` object, given two
:class:`_expression.FromClause`
expressions.

E.g.::

    j = join(
        user_table, address_table, user_table.c.id == address_table.c.user_id
    )
    stmt = select(user_table).select_from(j)

would emit SQL along the lines of:

.. sourcecode:: sql

    SELECT user.id, user.name FROM user
    JOIN address ON user.id = address.user_id

Similar functionality is available given any
:class:`_expression.FromClause` object (e.g. such as a
:class:`_schema.Table`) using
the :meth:`_expression.FromClause.join` method.

:param left: The left side of the join.

:param right: the right side of the join; this is any
 :class:`_expression.FromClause` object such as a
 :class:`_schema.Table` object, and
 may also be a selectable-compatible object such as an ORM-mapped
 class.

:param onclause: a SQL expression representing the ON clause of the
 join.  If left at ``None``, :meth:`_expression.FromClause.join`
 will attempt to
 join the two tables based on a foreign key relationship.

:param isouter: if True, render a LEFT OUTER JOIN, instead of JOIN.

:param full: if True, render a FULL OUTER JOIN, instead of JOIN.

.. seealso::

    :meth:`_expression.FromClause.join` - method form,
    based on a given left side.

    :class:`_expression.Join` - the type of object produced.

r   )leftrightonclauseisouterfulls        r9   joinrd     s    p X55r;   c                *    [         R                  " XS9$ )a%  Return a :class:`_expression.Lateral` object.

:class:`_expression.Lateral` is an :class:`_expression.Alias`
subclass that represents
a subquery with the LATERAL keyword applied to it.

The special behavior of a LATERAL subquery is that it appears in the
FROM clause of an enclosing SELECT, but may correlate to other
FROM clauses of that SELECT.   It is a special case of subquery
only supported by a small number of backends, currently more recent
PostgreSQL versions.

.. seealso::

    :ref:`tutorial_lateral_correlation` -  overview of usage.

)r5   )r   r7   )r8   r5   s     r9   lateralrf   F  s    * J22r;   c                    [        XUSUS9$ )a  Return an ``OUTER JOIN`` clause element.

The returned object is an instance of :class:`_expression.Join`.

Similar functionality is also available via the
:meth:`_expression.FromClause.outerjoin` method on any
:class:`_expression.FromClause`.

:param left: The left side of the join.

:param right: The right side of the join.

:param onclause:  Optional criterion for the ``ON`` clause, is
  derived from foreign key relationships established between
  left and right otherwise.

To chain joins together, use the :meth:`_expression.FromClause.join`
or
:meth:`_expression.FromClause.outerjoin` methods on the resulting
:class:`_expression.Join` object.

T)rb   rc   r   )r_   r`   ra   rc   s       r9   	outerjoinrh   ^  s    8 Xt$??r;   c                    g rC   rD   )__ent0s    r9   selectrk     s    69r;   c                    g rC   rD   )rj   __ent1s     r9   rk   rk     s     "r;   c                    g rC   rD   )rj   rm   __ent2s      r9   rk   rk     s     $'r;   c                    g rC   rD   )rj   rm   ro   __ent3s       r9   rk   rk     s     ),r;   c                    g rC   rD   )rj   rm   ro   rq   __ent4s        r9   rk   rk     s     .1r;   c                    g rC   rD   )rj   rm   ro   rq   rs   __ent5s         r9   rk   rk     s     36r;   c                    g rC   rD   )rj   rm   ro   rq   rs   ru   __ent6s          r9   rk   rk     s     8;r;   c                    g rC   rD   )rj   rm   ro   rq   rs   ru   rw   __ent7s           r9   rk   rk     s     =@r;   c	                    g rC   rD   )	rj   rm   ro   rq   rs   ru   rw   ry   __ent8s	            r9   rk   rk     s	     BEr;   c
                    g rC   rD   )
rj   rm   ro   rq   rs   ru   rw   ry   r{   __ent9s
             r9   rk   rk     s	     GJr;   c                     g rC   rD   entities__kws     r9   rk   rk     s     r;   c                 4    U(       a
  [        5       e[        U 6 $ )a  Construct a new :class:`_expression.Select`.


.. versionadded:: 1.4 - The :func:`_sql.select` function now accepts
   column arguments positionally.   The top-level :func:`_sql.select`
   function will automatically use the 1.x or 2.x style API based on
   the incoming arguments; using :func:`_sql.select` from the
   ``sqlalchemy.future`` module will enforce that only the 2.x style
   constructor is used.

Similar functionality is also available via the
:meth:`_expression.FromClause.select` method on any
:class:`_expression.FromClause`.

.. seealso::

    :ref:`tutorial_selecting_data` - in the :ref:`unified_tutorial`

:param \*entities:
  Entities to SELECT from.  For Core usage, this is typically a series
  of :class:`_expression.ColumnElement` and / or
  :class:`_expression.FromClause`
  objects which will form the columns clause of the resulting
  statement.   For those objects that are instances of
  :class:`_expression.FromClause` (typically :class:`_schema.Table`
  or :class:`_expression.Alias`
  objects), the :attr:`_expression.FromClause.c`
  collection is extracted
  to form a collection of :class:`_expression.ColumnElement` objects.

  This parameter will also accept :class:`_expression.TextClause`
  constructs as
  given, as well as ORM-mapped classes.

)r   r   r   s     r9   rk   rk     s    N h8r;   c                     [        U /UQ70 UD6$ )a  Produce a new :class:`_expression.TableClause`.

The object returned is an instance of
:class:`_expression.TableClause`, which
represents the "syntactical" portion of the schema-level
:class:`_schema.Table` object.
It may be used to construct lightweight table constructs.

:param name: Name of the table.

:param columns: A collection of :func:`_expression.column` constructs.

:param schema: The schema name for this table.

    .. versionadded:: 1.3.18 :func:`_expression.table` can now
       accept a ``schema`` argument.
r   )r5   columnskws      r9   tabler     s    & t,g,,,r;   c                ,    [         R                  " XX#S9$ )a  Return a :class:`_expression.TableSample` object.

:class:`_expression.TableSample` is an :class:`_expression.Alias`
subclass that represents
a table with the TABLESAMPLE clause applied to it.
:func:`_expression.tablesample`
is also available from the :class:`_expression.FromClause`
class via the
:meth:`_expression.FromClause.tablesample` method.

The TABLESAMPLE clause allows selecting a randomly selected approximate
percentage of rows from a table. It supports multiple sampling methods,
most commonly BERNOULLI and SYSTEM.

e.g.::

    from sqlalchemy import func

    selectable = people.tablesample(
        func.bernoulli(1), name="alias", seed=func.random()
    )
    stmt = select(selectable.c.people_id)

Assuming ``people`` with a column ``people_id``, the above
statement would render as:

.. sourcecode:: sql

    SELECT alias.people_id FROM
    people AS alias TABLESAMPLE bernoulli(:bernoulli_1)
    REPEATABLE (random())

:param sampling: a ``float`` percentage between 0 and 100 or
    :class:`_functions.Function`.

:param name: optional alias name

:param seed: any real-valued SQL expression.  When specified, the
 REPEATABLE sub-clause is also rendered.

)r5   seed)r   r7   )r8   samplingr5   r   s       r9   tablesampler   2  s    ^ 
4KKr;   c                     g rC   rD   rE   s    r9   unionr   d  rH   r;   c                     g rC   rD   rE   s    r9   r   r   j  rH   r;   c                 (    [         R                  " U 6 $ )a}  Return a ``UNION`` of multiple selectables.

The returned object is an instance of
:class:`_expression.CompoundSelect`.

A similar :func:`union()` method is available on all
:class:`_expression.FromClause` subclasses.

:param \*selects:
  a list of :class:`_expression.Select` instances.

:param \**kwargs:
  available keyword arguments are the same as those of
  :func:`select`.

)r   _create_unionrE   s    r9   r   r   p  s    & ''11r;   c                     g rC   rD   rE   s    r9   	union_allr     rH   r;   c                     g rC   rD   rE   s    r9   r   r     rH   r;   c                 (    [         R                  " U 6 $ )a)  Return a ``UNION ALL`` of multiple selectables.

The returned object is an instance of
:class:`_expression.CompoundSelect`.

A similar :func:`union_all()` method is available on all
:class:`_expression.FromClause` subclasses.

:param \*selects:
  a list of :class:`_expression.Select` instances.

)r   _create_union_allrE   s    r9   r   r     s     ++W55r;   )r5   literal_bindsc                    [        X!U S.6$ )a{  Construct a :class:`_expression.Values` construct.

The column expressions and the actual data for
:class:`_expression.Values` are given in two separate steps.  The
constructor receives the column expressions typically as
:func:`_expression.column` constructs,
and the data is then passed via the
:meth:`_expression.Values.data` method as a list,
which can be called multiple
times to add more data, e.g.::

    from sqlalchemy import column
    from sqlalchemy import values
    from sqlalchemy import Integer
    from sqlalchemy import String

    value_expr = values(
        column("id", Integer),
        column("name", String),
        name="my_values",
    ).data([(1, "name1"), (2, "name2"), (3, "name3")])

:param \*columns: column expressions, typically composed using
 :func:`_expression.column` objects.

:param name: the name for this VALUES construct.  If omitted, the
 VALUES construct will be unnamed in a SQL expression.   Different
 backends may have different requirements here.

:param literal_binds: Defaults to False.  Whether or not to render
 the data values inline in the SQL output, rather than using bound
 parameters.

)r   r5   r   )r5   r   r   s      r9   valuesr     s    N 7dCCr;   )NF)r8   r   r5   Optional[str]r6   boolreturnr   )r8   r1   r5   r   r=   r   r   r0   )rF   z_TypedSelectable[_TP]r   rA   )rF   z(_SelectStatementForCompoundArgument[_TP]r   rA   rC   )rR   zKOptional[Union[_ColumnsClauseArgument[Any], SelectBase, ScalarSelect[Any]]]r   r   )NFF)r_   r    r`   r    ra   Optional[_OnClauseArgument]rb   r   rc   r   r   r   )r8   z&Union[SelectBase, _FromClauseArgument]r5   r   r   r   )
r_   r    r`   r    ra   r   rc   r   r   r   )rj   
_TCCA[_T0]r   zSelect[Tuple[_T0]])rj   r   rm   
_TCCA[_T1]r   zSelect[Tuple[_T0, _T1]])rj   r   rm   r   ro   
_TCCA[_T2]r   zSelect[Tuple[_T0, _T1, _T2]])
rj   r   rm   r   ro   r   rq   
_TCCA[_T3]r   z!Select[Tuple[_T0, _T1, _T2, _T3]])rj   r   rm   r   ro   r   rq   r   rs   
_TCCA[_T4]r   z&Select[Tuple[_T0, _T1, _T2, _T3, _T4]])rj   r   rm   r   ro   r   rq   r   rs   r   ru   
_TCCA[_T5]r   z+Select[Tuple[_T0, _T1, _T2, _T3, _T4, _T5]])rj   r   rm   r   ro   r   rq   r   rs   r   ru   r   rw   
_TCCA[_T6]r   z0Select[Tuple[_T0, _T1, _T2, _T3, _T4, _T5, _T6]])rj   r   rm   r   ro   r   rq   r   rs   r   ru   r   rw   r   ry   
_TCCA[_T7]r   z5Select[Tuple[_T0, _T1, _T2, _T3, _T4, _T5, _T6, _T7]])rj   r   rm   r   ro   r   rq   r   rs   r   ru   r   rw   r   ry   r   r{   
_TCCA[_T8]r   z:Select[Tuple[_T0, _T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8]])rj   r   rm   r   ro   r   rq   r   rs   r   ru   r   rw   r   ry   r   r{   r   r}   z
_TCCA[_T9]r   z?Select[Tuple[_T0, _T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8, _T9]])r   z_ColumnsClauseArgument[Any]r   r   r   zSelect[Any])r5   strr   ColumnClause[Any]r   r   r   r   )NN)
r8   r    r   zUnion[float, Function[Any]]r5   r   r   z*Optional[roles.ExpressionElementRole[Any]]r   r   )r   r   r5   r   r   r   r   r   )E
__future__r   typingr   r   r   r   r   r	    r   r   _typingr   r   elementsr   r8   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.   _TCCA	functionsr/   r0   r1   r2   r3   r:   r@   _TypedSelectablerG   rM   rS   rU   rZ   rd   rf   rh   rk   r   r   r   r   r   rD   r;   r9   <module>r      s   #          +  "  &  "   ) '  # # ,*<<#"(& FK<<"/<>B<<F GL+?C$ =>  
# 

 
6 

3633 
# 

 
6 

7677$ 	** 	*Z 
# 

 
6 

6666 
# 

 
6 

:6::& -186
8686 *86 	86
 86 
86z 363
3 36 -1	@
@@ *@ 	@
 
@J 
 9 
 9 
"" *"" 
"
 
'' *'4>'!' 
'
 
,,, , 	,
 ', 
, 
111 1 	1
 1 ,1 
1 
666 6 	6
 6 6 16 
6 
;;; ; 	;
 ; ; ; 6; 
; 
	@	@	@ 	@ 		@
 	@ 	@ 	@ 	@ ;	@ 
	@ 

E
E
E 
E 	
E
 
E 
E 
E 
E 
E @
E 

E 
JJJ J 	J
 J J J J J J EJ 
J" 
*47 

)X-2 7;	/L#/L)/L /L 5	/L
 /Ld 
# 

 
6 

2622, 
# 

 
6 

6666( 'D'D
'D 'D 	'Dr;   