관리-도구
편집 파일: compiler.cpython-37.pyc
B ��4]�� � _ @ s d Z ddlZddlZddlZddlmZ ddlmZ ddlmZ ddlmZ ddlm Z dd lm Z dd lmZ ddlmZ dd lm Z ddlmZ edddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\d]d^d_d`dadbdcdddedfdgdhdidjdkdlg^�Ze�dmej�Ze�dnej�Zdodp� eddq�D ��drg�Ze�dsej�Ze�dsej�Ze�dtej�Ze�duej�Ze�dvej�Zdwdxdydzd{d|�Zejd}ej d~ej!dej"d�ej#d�ej$d�ej%d�ej&d�ej'd�ej(d�ej)d�ej*d�ej+d�ej,d�ej-d�ej.d�ej/d�ej0d�ej1d�ej2d�ej3d�ej4d�ej5d�ej6d�ej7d�ej8d�ej9d�ej:d�ej;d�ej<d�ej=d�ej>d�ej?d�ej@d�ejAd�ejBd�ejCd�i%ZDejEd�ejFd�ejGd�ejHd�ejId�ejJd�ejKd�ejLd�ejMd�ejNd�ejOd�ejPd�ejQd�ejRd�iZSd�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d��ZTe jUjVd�e jUjWd�e jUjXd�e jUjYd�e jUjZd�e jUj[d�iZ\G d�dƄ d�e]�Z^G d�dȄ d�e�_ej`e]��ZaG d�dʄ d�ejb�ZcG d�d̄ d�e^�ZdG d�d΄ d�ed�ZeG d�dЄ d�e^�ZfG d�d҄ d�ea�ZgG d�dԄ d�eg�ZhG d�dք d�e]�ZidS )�a] Base SQL and DDL compiler implementations. Classes provided include: :class:`.compiler.SQLCompiler` - renders SQL strings :class:`.compiler.DDLCompiler` - renders DDL (data definition language) strings :class:`.compiler.GenericTypeCompiler` - renders type specification strings. To generate user-defined SQL strings, see :doc:`/ext/compiler`. � N� )�crud)�elements)� functions)� operators)�schema)� selectable)�sqltypes)�visitors� )�exc)�util�allZanalyseZanalyze�and�any�array�asZascZ asymmetricZ authorizationZbetween�binaryZboth�case�cast�check�collate�column� constraint�createZcross�current_dateZcurrent_role�current_time�current_timestamp�current_user�default� deferrable�descZdistinctZdo�else�end�except�false�forZforeignZfreeze�from�fullZgrant�groupZhavingZilike�in� initially�innerZ intersectZinto�isZisnull�joinZleading�leftZlike�limit� localtime�localtimestampZnatural�new�notZnotnull�null�off�offset�old�on�only�or�orderZouterZoverlapsZplacingZprimaryZ references�right�select�session_user�setZsimilarZsome� symmetric�tableZthen�toZtrailing�true�union�unique�userZusing�verboseZwhen�wherez ^[A-Z0-9_$]+$z^[A-Z0-9_ $]+$c C s h | ]}t |��qS � )�str)�.0�xrJ rJ �J/opt/alt/python37/lib64/python3.7/site-packages/sqlalchemy/sql/compiler.py� <setcomp>� s rO � �$z5^(?:RESTRICT|CASCADE|SET NULL|NO ACTION|SET DEFAULT)$z^(?:DEFERRED|IMMEDIATE)$z%(?<![:\w\$\x5c]):([\w\$]+)(?![:\w\$])z\x5c(:[\w\$]*)(?![:\w\$])z %%(%(name)s)s�?z%%sz:[_POSITION]z :%(name)s)�pyformatZqmark�format�numeric�namedz AND z OR z + z * z - z / z % �-z < z <= z != z > z >= z = z IS DISTINCT FROM z IS NOT DISTINCT FROM z || z MATCH z NOT MATCH z IN z NOT IN z, z FROM z AS z IS z IS NOT z COLLATE zEXISTS z DISTINCT zNOT zANY zALL z DESCz ASCz NULLS FIRSTz NULLS LAST�coalesceZCURRENT_DATEZCURRENT_TIMEZCURRENT_TIMESTAMPZCURRENT_USERZ LOCALTIMEZLOCALTIMESTAMP�random�sysdateZSESSION_USERZUSERZCUBEZROLLUPz GROUPING SETS�month�day�year�second�hour�doy�minute�quarter�dow�week�epoch�milliseconds�microseconds� timezone_hour�timezone_minute)r[ r\ r] r^ r_ r` ra rb rc rd re rf rg rh ri �UNIONz UNION ALL�EXCEPTz EXCEPT ALL� INTERSECTz INTERSECT ALLc @ s� e Zd ZdZdZe�� Zdde�� fdd�Ze� dd�dd� �Z d d � Zedd� �Z d d� Zdd� Zddd�Zedd� �Zdd� Zdd� ZdS )�Compileda Represent a compiled SQL or DDL expression. The ``__str__`` method of the ``Compiled`` object should produce the actual text of the statement. ``Compiled`` objects are specific to their underlying database dialect, and also may or may not be specific to the columns referenced within a particular set of bind parameters. In no case should the ``Compiled`` object be dependent on the actual values of those bind parameters, even though it may reference those values as defaults. Nc C sb || _ || _| j j| _|r(| j�|�| _|dk r^|| _|j| _| jrL|j| _ | j | jf|�| _dS )aq Construct a new :class:`.Compiled` object. :param dialect: :class:`.Dialect` to compile against. :param statement: :class:`.ClauseElement` to be compiled. :param bind: Optional Engine or Connection to compile this statement against. :param schema_translate_map: dictionary of schema names to be translated when forming the resultant SQL .. versionadded:: 1.1 .. seealso:: :ref:`schema_translating` :param compile_kwargs: additional kwargs that will be passed to the initial call to :meth:`.Compiled.process`. N)�dialect�bindZidentifier_preparer�preparer�_with_schema_translate� statementZsupports_execution�can_execute�_execution_options�execution_options�process�string)�selfrn rr ro �schema_translate_mapZcompile_kwargsrJ rJ rN �__init__ s zCompiled.__init__z0.7z�The :meth:`.Compiled.compile` method is deprecated and will be removed in a future release. The :class:`.Compiled` object now runs its compilation within the constructor, and this method does nothing.c C s dS )zDProduce the internal string representation of this element. NrJ )rx rJ rJ rN �compileA s zCompiled.compilec C s$ | j r|�| ||�S t�| j��d S )N)rs �_execute_compiledr ZObjectNotExecutableErrorrr )rx Z connection�multiparams�paramsrJ rJ rN �_execute_on_connectionM s zCompiled._execute_on_connectionc C s t � �dS )z�Return a Compiled that is capable of processing SQL expressions. If this compiler is one, it would likely just return 'self'. N)�NotImplementedError)rx rJ rJ rN �sql_compilerS s zCompiled.sql_compilerc K s |j | f|�S )N)�_compiler_dispatch)rx �obj�kwargsrJ rJ rN rv ] s zCompiled.processc C s | j pdS )z3Return the string text of the generated SQL or DDL.� )rw )rx rJ rJ rN �__str__` s zCompiled.__str__c C s t � �dS )z�Return the bind params for this compiled object. :param params: a dict of string/object pairs whose values will override bind values compiled in to the statement. N)r� )rx r~ rJ rJ rN �construct_paramse s zCompiled.construct_paramsc C s | � � S )z0Return the bind params for this compiled object.)r� )rx rJ rJ rN r~ o s zCompiled.paramsc O s* | j }|dkrtjddd��|�| ||�S )zExecute this compiled object.Nz>This Compiled object is not bound to any Engine or Connection.Z2afi)�code)ro r ZUnboundExecutionErrorr| )rx r} r~ �erJ rJ rN �executet s zCompiled.executec O s | j ||��� S )zJExecute this compiled object and return the result's scalar value.)r� �scalar)rx r} r~ rJ rJ rN r� � s zCompiled.scalar)N)�__name__� __module__�__qualname__�__doc__Z_cached_metadatar � immutabledictru rz Z deprecatedr{ r �propertyr� rv r� r� r~ r� r� rJ rJ rJ rN rm � s"