File: //usr/local/lib/python3.10/dist-packages/sqlalchemy/sql/__pycache__/elements.cpython-310.pyc
o
���g/� � @ s�
d Z ddlmZ ddlmZ ddlmZ ddlZddlZddl Z ddl
Z
ddl
mZ ddl
mZ ddl
m
Z
dd l
mZ dd
l
mZ ddl
mZ ddl
mZ dd
l
mZ ddl
mZ ddl
mZ ddl
mZ ddl
mZ ddl
mZ ddl
mZ ddl
mZ ddl
mZ ddl
mZ ddl
mZ ddl
mZ ddl
mZ ddl m!Z! 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: dd1l9m;Z; dd2l!m<Z< dd3l"m=Z= dd4l$m>Z> dd5l?m@Z@ dd6l?mAZA dd7l?mBZB dd8l?mCZC dd9l?mDZD d:d;l mEZE d:d<l mFZF d:d=l mGZG d:d>lGmHZH d:d?lGmIZI d:d@lJmKZK d:dAlJmLZL d:dBlJmMZM e
j�r\ddCl&mNZN ddDl&mOZO ddEl&mPZP ddFl&mQZQ ddGl&mRZR ddHl&mSZS ddIl&mTZT ddJl.mUZU ddKl9mVZV ddLl9mWZW ddMlXmYZY ddNlXmZZZ ddOl[m\Z\ ddPl"m]Z] ddQl^m_Z_ ddRl^m`Z` ddSl^maZa ddTl^mbZb ddUlcmdZd ddVlcmeZe ddWlcmfZf ddXlcmgZg ddYlhmiZi ddZl%mjZj dd[l?mkZk dd\l?mlZl dd]l?mmZm d:d^lnmoZo d:d_lnmpZp d:d`lqmrZr d:dalqmsZs d:dblqmtZt d:dclqmuZu d:ddlqmvZv d:delwmxZx eeyef Zzeeye{ef Z|edfdgdh�Z}ediedjdk�Z~edldgdh�Zedmdndh�Z�edodpdh�Z�e q�d�ddydz��Z�e q�d�dd|dz��Z�e q�d�dddz��Z� q�d�dd�dz�Z� �d�dd�d��Z�G d�d�� d�eD�Z�eFj�G d�d�� d�e-e:e>eAe���Z�G d�d�� d�e��Z�G d�d�� d�e#j�e#j�e#j�e��Z�G d�d�� d�ee~ e=eI�Z�G d�d�� d�e�e~ e#j�e~ eI�Z�e�Z�G d�d�� d�e#j�e#j�e#j�e#j�e} e#j�e#j�e#j�e#j�e#j�e#j�e�e} e��Z�G d�d�� d�e�e} �Z�G d�d�� d�e�e} �Z�G d�d�� d�e#j�e�e} �Z�G d�d�� d�e��Z�G d�d�� d�e#j�e#j�e#j�e#j�e#j�e#j�e#j�e#j�e4e3e�e#j�e eFj�d� �Z�G d�d�� d�e8e#j�d e�d �Z�e���� G d�d�� d�e8e#j�e� e�e� �Z�e���� G d�d�� d�e8e#j�e� e�e� �Z�e���� G d�d�� d�e#j�e#j�e#j�e#j�e��Z�G d�d�� d�e�e} �Z�G d�d�� d�e�e} �Z�G d�d�� d�e�e� �Z�e�j�Z�e�j�Z�G d�d�� d�e�e�eed�f �ZG d�d�� d�e�e} �Z�G d�d�� d�e�e} �Z�G d�d�� d�e�e} �Z�G d�d�� d�e�e} �Z�G d�d�� d�e�e{ �Z�G d�d�� d�e�e} �Z�G d�d�� d�e�e �Z�G d�d�� d�e�e} �Z�G d�d�� d�e�e} �Z�G d�dÄ d�e�e� e�e� �Z�G d�dń d�e�e} �Z�G d�dDŽ d�e�e �Z�G d�dɄ d�e�e �Z�G d�d˄ d�e��Z�G d�d̈́ d�e�e�e} �Z�G d�dτ d�e�e} �Z�G d�dф d�e�Z�e�j�Z�e�j�Z�ee{e�f Z�G d�dӄ d�e�e} �Z�G d�dՄ d�e�e} �Z�G d�dׄ d�e4e�e} �Z�G d�dل d�e�e} �Z�eLdڃZ�G d�d܄ d�e#j�e} e�e} �Z�G d�dބ d�e#j�e#j�e} e#j�e6e�e} �Z�G d�d� d�e�e} �Z�G d�d� d�e�e� �Z�G d�d� d�e3e��Z�G d�d� d�eZ�G d�d� d�eZ�G d�d� d�eZ�G d�d� d�eGj�ẽZӐd d�d�ZԐd
d�d��ZՐdd�d��Z�G d�d�� d�eGj�d� �Z�G d�d�� d�e,�Z�G d�d�� d�eӃZ�G d�d�� d�eڃZ�e�Z�G �d �d� �deڃZ�dS ( z�Core SQL expression elements, including :class:`_expression.ClauseElement`,
:class:`_expression.ColumnElement`, and derived classes.
� )�annotations)�Decimal)�EnumN)�AbstractSet)�Any)�Callable)�cast)�Dict)� FrozenSet)�Generic)�Iterable)�Iterator)�List)�Mapping)�Optional)�overload)�Sequence)�Set)�Tuple)�Type)�
TYPE_CHECKING)�TypeVar)�Union� )� coercions)� operators)�roles)�
traversals)�type_api)�has_schema_attr)�is_named_from_clause)�is_quoted_name)�
is_tuple_type)� Annotated)�SupportsWrappingAnnotations)�_clone)�_expand_cloned)�_generative)�_NoArg)�
Executable)�
Generative)�HasMemoized)� Immutable)�NO_ARG)�SingletonConstant)�MemoizedHasCacheKey)�NO_CACHE)�_document_text_coercion)�ColumnOperators)�HasCopyInternals)�cloned_traverse)�ExternallyTraversible)�InternalTraversal)�traverse)� Visitable� )�exc)�
inspection)�util)�!HasMemoized_ro_memoized_attribute)�
TypingOnly)�Literal)� ParamSpec)�Self)�_ByArgument)�_ColumnExpressionArgument)�#_ColumnExpressionOrStrLabelArgument)�_HasDialect)� _InfoType)�_PropagateAttrsType)�_TypeEngineArgument)� ColumnSet)�_CacheKeyTraversalType)�CacheKey)�Compiled)�SQLCompiler)�FunctionElement)�OperatorType)�Column)�DefaultGenerator)�FetchedValue)�
ForeignKey)�_SelectIterable)�
FromClause)�NamedFromClause)�
TextualSelect)� TupleType)�
TypeEngine)�_CloneCallableType)�_TraverseInternalsType)�anon_map)�
Connection)�Dialect)�_CoreMultiExecuteParams)�
CacheStats)�CompiledCacheType)�CoreExecuteOptionsParameter)�SchemaTranslateMapType)�Result�_Tr )�bound�_T_coT)rf � covariant�_OPT�_NT�_NUMERIC�_NMT�_NUMBERF�value�type_�_TypeEngineArgument[_T]�literal_execute�bool�return�BindParameter[_T]c C � d S �N� �rn ro rq rw rw �B/usr/local/lib/python3.10/dist-packages/sqlalchemy/sql/elements.py�literal� � rz �Nonec C ru rv rw rx rw rw ry rz � r{ �"Optional[_TypeEngineArgument[Any]]�BindParameter[Any]c C ru rv rw rx rw rw ry rz � r{ c C s t jtj| ||d�S )a Return a literal clause, bound to a bind parameter.
Literal clauses are created automatically when non-
:class:`_expression.ClauseElement` objects (such as strings, ints, dates,
etc.) are
used in a comparison operation with a :class:`_expression.ColumnElement`
subclass,
such as a :class:`~sqlalchemy.schema.Column` object. Use this function
to force the generation of a literal clause, which will be created as a
:class:`BindParameter` with a bound value.
:param value: the value to be bound. Can be any Python object supported by
the underlying DB-API, or is translatable via the given type argument.
:param type\_: an optional :class:`~sqlalchemy.types.TypeEngine` which will
provide bind-parameter translation for this literal.
:param literal_execute: optional bool, when True, the SQL engine will
attempt to render the bound value directly in the SQL statement at
execution time rather than providing as a parameter value.
.. versionadded:: 2.0
)ro rq )r �expectr �LiteralValueRolerx rw rw ry rz � s ��text�str�!Optional[_TypeEngineArgument[_T]]�ColumnClause[_T]c C s t | |dd�S )a� Produce a :class:`.ColumnClause` object that has the
:paramref:`_expression.column.is_literal` flag set to True.
:func:`_expression.literal_column` is similar to
:func:`_expression.column`, except that
it is more often used as a "standalone" column expression that renders
exactly as stated; while :func:`_expression.column`
stores a string name that
will be assumed to be part of a table and may be quoted as such,
:func:`_expression.literal_column` can be that,
or any other arbitrary column-oriented
expression.
:param text: the text of the expression; can be any SQL expression.
Quoting rules will not be applied. To specify a column-name expression
which should be subject to quoting rules, use the :func:`column`
function.
:param type\_: an optional :class:`~sqlalchemy.types.TypeEngine`
object which will
provide result-set translation and additional expression semantics for
this column. If left as ``None`` the type will be :class:`.NullType`.
.. seealso::
:func:`_expression.column`
:func:`_expression.text`
:ref:`tutorial_select_arbitrary_text`
T)ro �
is_literal��ColumnClause)r� ro rw rw ry �literal_column� s #r� c @ sX e Zd ZdZdZdZdZdZe� d�e� d� dddd���Z
ddd�Zddd�ZdS )�CompilerElementznbase class for SQL elements that can be compiled to produce a
SQL string.
.. versionadded:: 2.0
rw �compiler_elementF�defaultzsqlalchemy.engine.defaultzsqlalchemy.engine.urlN�bind�Optional[_HasDialect]�dialect�Optional[Dialect]�kwr rs rL c K s^ |du r&|r
|j }n| jdkrtjj}|�� }ntjj}|j�| j�� � � }| j
|fi |��S )a� Compile this SQL expression.
The return value is a :class:`~.Compiled` object.
Calling ``str()`` or ``unicode()`` on the returned value will yield a
string representation of the result. The
:class:`~.Compiled` object also can return a
dictionary of bind parameter names and values
using the ``params`` accessor.
:param bind: An :class:`.Connection` or :class:`.Engine` which
can provide a :class:`.Dialect` in order to generate a
:class:`.Compiled` object. If the ``bind`` and
``dialect`` parameters are both omitted, a default SQL compiler
is used.
:param column_keys: Used for INSERT and UPDATE statements, a list of
column names which should be present in the VALUES clause of the
compiled statement. If ``None``, all columns from the target table
object are rendered.
:param dialect: A :class:`.Dialect` instance which can generate
a :class:`.Compiled` object. This argument takes precedence over
the ``bind`` argument.
:param compile_kwargs: optional dictionary of additional parameters
that will be passed through to the compiler within all "visit"
methods. This allows any custom flag to be passed through to
a custom compilation construct, for example. It is also used
for the case of passing the ``literal_binds`` flag through::
from sqlalchemy.sql import table, column, select
t = table("t", column("x"))
s = select(t).where(t.c.x == 5)
print(s.compile(compile_kwargs={"literal_binds": True}))
.. seealso::
:ref:`faq_sql_expression_string`
Nr� )r� �stringify_dialectr<