관리-도구
편집 파일: elements.cpython-38.pyc
U -?�f�� � @ 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 ddJl9mUZU ddKl9mVZV ddLlWmXZX ddMlWmYZY ddNlZm[Z[ ddOl"m\Z\ ddPl]m^Z^ ddQl]m_Z_ ddRl]m`Z` ddSl]maZa ddTlbmcZc ddUlbmdZd ddVlbmeZe ddWlbmfZf ddXlgmhZh ddYl%miZi ddZl?mjZj dd[l?mkZk dd\l?mlZl d:d]lmmnZn d:d^lmmoZo d:d_lpmqZq d:d`lpmrZr d:dalpmsZs d:dblpmtZt d:dclpmuZu d:ddlvmwZw eexef Zyeexezef Z{ededfdg�Z|edhedidj�Z}edkdfdg�Z~edldmdg�Zedndodg�Z�ed�dfdqdrdsdt�dudv��Z�ed�dedwdrdsdt�dxdv��Z�e�d dfdydrdzdt�d{dv��Z��ddfdydrdzdt�d|dv�Z��dd}d~dd��d�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�ez �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�dÄ d�e�e �Z�G d�dń d�e�e �Z�G d�dDŽ 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�eeze�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�e̓Z�G d�d� d�e̓Z�G d�d� d�e̓Z�G d�d� d�eGj�e˃Z�d�d�d�d�d�Z�d�d�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�� d�eك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)�_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)re � covariant�_OPT�_NT�_NUMERIC�_NMT�_NUMBERF�_TypeEngineArgument[_T]�bool�BindParameter[_T])�value�type_�literal_execute�returnc C s d S �N� �rp rq rr ru ru �G/opt/hc_python/lib64/python3.8/site-packages/sqlalchemy/sql/elements.py�literal� s rx �Nonec C s d S rt ru rv ru ru rw rx � s �"Optional[_TypeEngineArgument[Any]]�BindParameter[Any]c C s d S rt ru rv ru ru rw rx � s 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 )rq rr )r �expectr ZLiteralValueRolerv ru ru rw rx � s ��str�!Optional[_TypeEngineArgument[_T]]zColumnClause[_T])�textrq rs 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)rq � is_literal��ColumnClause)r rq ru ru rw �literal_column� s #r� c @ sj e Zd ZdZdZdZdZdZe� d�e� d�dd d ddd �dd���Z dddd�dd�Zdd�dd�ZdS )�CompilerElementznbase class for SQL elements that can be compiled to produce a SQL string. .. versionadded:: 2.0 ru Zcompiler_elementF�defaultzsqlalchemy.engine.defaultzsqlalchemy.engine.urlN�Optional[_HasDialect]�Optional[Dialect]r rK ��bind�dialect�kwrs c K sZ |dkrL|r|j }n8| jdkr0tjj}|�� }ntjj}|j�| j�� � � }| j |f|�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<