관리-도구
편집 파일: query.cpython-37.pyc
B ��4].� � @ sH d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlm Z dd lm Z dd lmZ ddlm Z ddlmZ dd lmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlm Z ddlm!Z! ddlmZ ddl!m"Z" ddl!mZ# ddl!m$Z$ dd l%m&Z& dd!l'm(Z( dd"l)m*Z* d#d$d%gZ+ej,Z-ej.e j/G d&d#� d#e0���Z1G d'd(� d(e*�Z2G d)d*� d*e0�Z3G d+d,� d,e3�Z4ej.G d-d.� d.e��Z5G d/d0� d0e3�Z6G d1d2� d2e3�Z7G d3d$� d$e0�Z8G d4d5� d5ej9�Z:d6S )7a� The Query class and support. Defines the :class:`.Query` class, the central construct used by the ORM to construct database queries. The :class:`.Query` class should not be confused with the :class:`.Select` class, which defines database SELECT operations at the SQL (non-ORM) level. ``Query`` differs from ``Select`` in that it returns ORM-mapped objects and interacts with an ORM session, whereas the ``Select`` construct interacts directly with the database to return iterable result sets. � )�chain� )� attributes)�exc)� interfaces)�loading)�persistence)� properties)�_entity_descriptor)�_generative)�_is_aliased_class)�_is_mapped_class)�_orm_columns)�InspectionAttr)�PathRegistry)�_entity_corresponds_to)�aliased)�AliasedClass)�join)� object_mapper)� ORMAdapter)�with_parent� )�inspect)� inspection)�log)�sql)�util)� expression)�visitors)�ColumnCollection)�_interpret_as_from)�ForUpdateArg�Query�QueryContextr c @ s� e Zd ZdZdZdZdZdZdZdZ dZ dZdZdZ dZdZdZdZdZdZe� ZdZdZdZdZdZdZdZdZdZdZi Z dZ!dZ"e#�$� Z%Z&e#�$� Z'e#�$� Z(e#�$� Z)dZ*dZ+dZ,dZ-dZ.e/Z0dZ1dZ2�ddd�Z3�ddd �Z4d d� Z5dd � Z6dd� Z7dd� Z8dd� Z9dd� Z:e;� dd� �Z<e;� dd� �Z=dd� Z>dd� Z?dd� Z@d d!� ZAeBd"d#� �ZCd$d%� ZDd&d'� ZEd(d)� ZF�dd*d+�ZGd,d-� ZHd.d/� ZId0d1� ZJ�dd2d3�ZK�dd4d5�ZLd6d7� ZMd8d9� ZNd:d;� ZO�dd<d=�ZPd>d?� ZQeBd@dA� �ZR�ddBdC�ZS�ddDdE�ZTdFdG� ZUdHdI� ZVeBdJdK� �ZWdLdM� ZXe;� dNdO� �ZYe;� dPdQ� �ZZdRdS� Z[e;� dTdU� �Z\e;� dVdW� �Z]eBdXdY� �Z^e;� dZd[� �Z_e;eM��dd\d]��Z`e;� d^d_� �Zad`da� Zbdecjddfdbdc�Ze�dddde�Zfe;� dfdg� �Zge;� dhdi� �Zhe;� djdk� �Zie;� dldm� �Zj�ddndo�Zke;� �ddpdq��Zle;� drds� �Zmdtdu� Zne;� dvdw� �Zoe;� dxdy� �Zpdzd{� ZqeqZrd|d}� Zse;� d~d� �Zte;� d�d�� �Zue#�vd�d�d�d�d�� �Zwd�d�� Zxd�d�� Zye;� d�d�� �Zzd�d�� Z{e;� �dd�d���Z|�dd�d��Z}d�d�� Z~e;� d�d�� �Ze;� e#��d�d��d�d�� ��Z�e;� �dd�d���Z�e;� d�d�� �Z�e;eNeO�d�d�� �Z�d�d�� Z�e;eNeO�d�d�� �Z�e;eNeO�d�d�� �Z�e;eNeO�d�d�� �Z�d�d�� Z�d�d�� Z�d�d�� Z�d�d�� Z�d�d�� Z�d�d�� Z�d�d�� Z�d�d�� Z�d�d�� Z�d�d�� Z�e;eNeO�d�d�� �Z�d�d�� Z�d�d Z�d�dĄ Z�d�dƄ Z�d�dȄ Z�e;eN�d�dʄ �Z�e;eM�d�d̄ �Z�e;eM�d�d΄ �Z�d�dЄ Z�e;eN�d�d҄ �Z�e;eN�d�dԄ �Z�e;eN�d�dք �Z�e;eN�d�d �Z�e;� d�dڄ �Z�e;� d�d܄ �Z�d�dބ Z�e;eM�d�d� �Z�d�d� Z�d�d� Z�d�d� Z�d�d� Z�d�d� Z�d�d� Z�d�d� Z�d�d� Z�d�d� Z�d�d� Z�eBd�d�� �Z��dd�d��Z��d d�d��Z�eBd�d�� �Z�eBd�d�� �Z�d��d � Z��d�d� Z��d!�d�d�Z��d"�d�d�Z��d#�d�d �Z��d �d� Z��d�d � Z��d�d� Z�dS ($ r# aL ORM-level SQL construction object. :class:`.Query` is the source of all SELECT statements generated by the ORM, both those formulated by end-user query operations as well as by high level internal operations such as related collection loading. It features a generative interface whereby successive calls return a new :class:`.Query` object, a copy of the former with additional criteria and options associated with it. :class:`.Query` objects are normally initially generated using the :meth:`~.Session.query` method of :class:`.Session`, and in less common cases by instantiating the :class:`.Query` directly and associating with a :class:`.Session` using the :meth:`.Query.with_session` method. For a full walkthrough of :class:`.Query` usage, see the :ref:`ormtutorial_toplevel`. FTN� c C s || _ i | _| �|� dS )a� Construct a :class:`.Query` directly. E.g.:: q = Query([User, Address], session=some_session) The above is equivalent to:: q = some_session.query(User, Address) :param entities: a sequence of entities and/or SQL expressions. :param session: a :class:`.Session` with which the :class:`.Query` will be associated. Optional; a :class:`.Query` can be associated with a :class:`.Session` generatively via the :meth:`.Query.with_session` method as well. .. seealso:: :meth:`.Session.query` :meth:`.Query.with_session` N)�session�_polymorphic_adapters� _set_entities)�self�entitiesr&