
H`Tc           @   s  d  Z  d d l m Z m Z d d l m Z d d l m Z m Z d d l m	 Z
 m Z d d l m Z m Z d d l m Z d d l m Z m Z m Z m Z d	 e e f d
     YZ d e f d     YZ d e f d     YZ e   d( d   Z e j d    Z e   d    Z e j d    Z e   d( d   Z e j d    Z e j d    Z e   d    Z  e  j d    Z  e  j d    Z! e   d    Z" e" j d    Z" e" j d    Z# e   d    Z$ e$ j d    Z$ e   d    Z% e% j d    Z% e   d     Z& e& j d!    Z& e   d"    Z' e' j d#    Z' e   d$    Z( e( j d%    Z( e   d&    Z) e) j d'    Z) d( S()   s   

i   (   t   MapperOptiont   PropComparatori   (   t   util(   t   _generativet
   Generative(   t   exct   inspect(   t   _is_aliased_classt   _class_to_mapper(   t   PathRegistryt   TokenRegistryt   _WILDCARD_TOKENt   _DEFAULT_TOKENt   Loadc           B   s   e  Z d  Z d   Z d   Z d Z e Z d   Z	 d   Z
 d   Z e d  Z d   Z e e d   Z e d d	   Z d
   Z d   Z d   Z d   Z RS(   sC
  Represents loader options which modify the state of a
    :class:`.Query` in order to affect how various mapped attributes are
    loaded.

    .. versionadded:: 0.9.0 The :meth:`.Load` system is a new foundation for
       the existing system of loader options, including options such as
       :func:`.orm.joinedload`, :func:`.orm.defer`, and others.   In
       particular, it introduces a new method-chained system that replaces the
       need for dot-separated paths as well as "_all()" options such as
       :func:`.orm.joinedload_all`.

    A :class:`.Load` object can be used directly or indirectly.  To use one
    directly, instantiate given the parent class.  This style of usage is
    useful when dealing with a :class:`.Query` that has multiple entities,
    or when producing a loader option that can be applied generically to
    any style of query::

        myopt = Load(MyClass).joinedload("widgets")

    The above ``myopt`` can now be used with :meth:`.Query.options`::

        session.query(MyClass).options(myopt)

    The :class:`.Load` construct is invoked indirectly whenever one makes use
    of the various loader options that are present in ``sqlalchemy.orm``,
    including options such as :func:`.orm.joinedload`, :func:`.orm.defer`,
    :func:`.orm.subqueryload`, and all the rest.  These constructs produce an
    "anonymous" form of the :class:`.Load` object which tracks attributes and
    options, but is not linked to a parent class until it is associated with a
    parent :class:`.Query`::

        # produce "unbound" Load object
        myopt = joinedload("widgets")

        # when applied using options(), the option is "bound" to the
        # class observed in the given query, e.g. MyClass
        session.query(MyClass).options(myopt)

    Whether the direct or indirect style is used, the :class:`.Load` object
    returned now represents a specific "path" along the entities of a
    :class:`.Query`.  This path can be traversed using a standard
    method-chaining approach.  Supposing a class hierarchy such as ``User``,
    ``User.addresses -> Address``, ``User.orders -> Order`` and
    ``Order.items -> Item``, we can specify a variety of loader options along
    each element in the "path"::

        session.query(User).options(
                    joinedload("addresses"),
                    subqueryload("orders").joinedload("items")
                )

    Where above, the ``addresses`` collection will be joined-loaded, the
    ``orders`` collection will be subquery-loaded, and within that subquery
    load the ``items`` collection will be joined-loaded.


    c         C   s.   t  |  } | j |  _ i  |  _ i  |  _ d  S(   N(   R   t   _path_registryt   patht   contextt
   local_opts(   t   selft   entityt   insp(    (    se   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/orm/strategy_options.pyt   __init__Q   s    	c         C   s"   t  t |   j   } i  | _ | S(   N(   t   superR   t	   _generateR   (   R   t   cloned(    (    se   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/orm/strategy_options.pyR   W   s    	c         C   s   |  j  | t  d  S(   N(   t   _processt   True(   R   t   query(    (    se   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/orm/strategy_options.pyt   process_query_   s    c         C   s   |  j  | t  d  S(   N(   R   t   False(   R   R   (    (    se   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/orm/strategy_options.pyt   process_query_conditionallyb   s    c         C   s   | j  } | rl xm |  j j   D]F \ \ } } } |  j | |  } | d  k	 r | | j | | f <q q Wn | j j |  j  d  S(   N(   t   _current_pathR   t   itemst
   _chop_patht   Nonet   _attributest   update(   R   R   t   raiseerrt   current_patht   tokent
   start_patht   loadert   chopped_start_path(    (    se   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/orm/strategy_options.pyR   e   s    	"c   
      C   s7  | rY | j  rY t | t  r1 t j d   qY t j d | j j | j j f   n  t | t	 j
  r3| j t  } | j t  s | r | r t |  _ n  | r d | | f } n  | j |  Sy t | j j |  } Wn: t k
 r| rt j d | | j f   q&d  Sn
 X| j } | | } n | j } | j j | j  s}| rvt j d | | j f   q}d  Sn  t | d d   r| j } t |  } | j }	 | j st j | j j | j d t d t } n  | j | j  |  j! d	 t |   | | |	 } n
 | | } | j  r3| j } n  | S(
   Ns3   Wildcard token cannot be followed by another entitys?   Attribute '%s' of entity '%s' does not refer to a mapped entitys   %s:%ssF   Can't find property named '%s' on the mapped entity %s in this Query. s.   Attribute '%s' does not link from element '%s't   _of_typet   aliasedt   _use_mapper_patht   path_with_polymorphic("   t
   has_entityt
   isinstanceR
   t   sa_exct   ArgumentErrort   propt   keyt   parentR   R   t   string_typest   endswithR   R   R   t   propagate_to_loadersR'   t   getattrt   class_t   AttributeErrorR"   t   propertyt   common_parentt   mapperR+   R   t   is_aliased_classt   orm_utilt   with_polymorphict   base_mapperR   t   entity_patht   setR   (
   R   R   t   attrt   wildcard_keyR%   t   default_tokenR3   t   act   ext_infot   path_element(    (    se   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/orm/strategy_options.pyt   _generate_patho   s`    						
	c         C   s+   | d  k	 r' t t | j     } n  | S(   N(   R"   t   tuplet   sortedR    (   R   t   strategy(    (    se   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/orm/strategy_options.pyt   _coerce_strat   s    c         C   sY   |  j  |  } | |  _ |  j |  j | d  |  _ | |  _ | d  k	 rU |  j   n  d  S(   Nt   relationship(   RO   R8   RK   R   RN   R"   t   _set_path_strategy(   R   RE   RN   R8   (    (    se   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/orm/strategy_options.pyt   set_relationship_strategy   s    		c         C   s   |  j  |  } xp | D]h } |  j |  j | d  } |  j   } | | _ | | _ t | _ | rt | j j |  n  | j	   q Wd  S(   Nt   column(
   RO   RK   R   R   RN   R   R8   R   R$   RQ   (   R   t   attrsRN   t   optsRE   R   R   (    (    se   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/orm/strategy_options.pyt   set_column_strategy   s    			c         C   sH   |  j  j r+ |  j  j j |  j d |   n |  j  j |  j d |   d  S(   NR)   (   R   R/   R5   RD   R   (   R   (    (    se   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/orm/strategy_options.pyRQ      s    c         C   s&   |  j  j   } |  j j   | d <| S(   NR   (   t   __dict__t   copyR   t	   serialize(   R   t   d(    (    se   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/orm/strategy_options.pyt   __getstate__   s    c         C   s)   |  j  j |  t j |  j  |  _ d  S(   N(   RW   R$   R	   t   deserializeR   (   R   t   state(    (    se   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/orm/strategy_options.pyt   __setstate__   s    c         C   s   d } x t  t | | j   D] \ } \ } } t | t j  r | d k rf | j d t  rf | S| d t f k r | | j	 k r d  Sn  | | k r q q d  Sq W| | d S(   Nii    t   :s   relationship:%si   (   t	   enumeratet   zipR   R0   R   R6   R7   R   R   R4   R"   (   R   t   to_chopR   t   it   c_tokent   p_token(    (    se   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/orm/strategy_options.pyR!      s    +N(   t   __name__t
   __module__t   __doc__R   R   R"   RN   R   R8   R   R   R   R   RK   RO   R   RR   RV   RQ   R[   R^   R!   (    (    (    se   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/orm/strategy_options.pyR      s$   9					
E	
			t   _UnboundLoadc           B   s}   e  Z d  Z d   Z e Z d   Z d   Z d   Z d   Z	 d   Z
 e d    Z d   Z d	   Z d
   Z d   Z RS(   s2  Represent a loader option that isn't tied to a root entity.

    The loader option will produce an entity-linked :class:`.Load`
    object when it is passed :meth:`.Query.options`.

    This provides compatibility with the traditional system
    of freestanding options, e.g. ``joinedload('x.y.z')``.

    c         C   s"   d |  _  t   |  _ i  |  _ d  S(   N(    (   R   RD   t   _to_bindR   (   R   (    (    se   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/orm/strategy_options.pyR     s    	c         C   s   |  j  j |   d  S(   N(   Rj   t   add(   R   (    (    se   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/orm/strategy_options.pyRQ   	  s    c         C   s`   | rU t  | t j  rU | t t f k rU | t k rB t |  _ n  d | | f } n  | | f S(   Ns   %s:%s(   R0   R   R6   R   R   R   R8   (   R   R   RE   RF   (    (    se   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/orm/strategy_options.pyRK     s    c         C   sy   |  j  j   } g  | d <} xU t j |  j  D]A } t | t  rd | j | j j	 | j
 f  q0 | j |  q0 W| S(   NR   (   RW   RX   R   t   to_listR   R0   R   t   appendt   _parentmapperR:   R4   (   R   RZ   t   retR'   (    (    se   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/orm/strategy_options.pyR[     s    c         C   sy   g  } xS | d D]G } t  | t  rK | \ } } | j t | |   q | j |  q Wt |  | d <| |  _ d  S(   NR   (   R0   RL   Rm   R9   RW   (   R   R]   Ro   R4   t   clst   propkey(    (    se   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/orm/strategy_options.pyR^     s    c         C   s.   x' |  j  D] } | j | | j |  q
 Wd  S(   N(   Rj   t   _bind_loaderR#   (   R   R   R%   t   val(    (    se   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/orm/strategy_options.pyR   *  s    c   
      C   s   t    } d   } g  | D] } | |  D] } | ^ q) q }	 xH |	 d d !D]9 } | rm | | | |  } n | j |  } t | _ qL W| | |	 d |  } t | _ | S(   Nc         S   s]   t  |  t j  rR |  t k r% t f S|  j d t  rE |  d }  n  |  j d  S|  f Sd  S(   Nt   .i   (   R0   R   R6   R   R   t
   startswitht   split(   R4   (    (    se   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/orm/strategy_options.pyt
   _split_key2  s    i    i(   Ri   t   defaultloadR   t   _is_chain_linkR   (
   R   t   metht   keyst   chainedt   kwt   optRw   R4   R'   t
   all_tokens(    (    se   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/orm/strategy_options.pyt
   _from_keys.  s    		,	c         C   s   d } x t  t | | j     D] \ } \ } \ } } t | t j  r | d k ro | j d t  ro | S| d t f k r | | j	 k r d  Sq" t | t  r" | j | k	 r d  Sq" q" W| d 7} | | S(   Nii    R_   s   relationship:%si   (   R`   Ra   t   pairsR0   R   R6   R7   R   R   R4   R"   R   R<   (   R   Rb   R   Rc   Rd   t   p_mappert   p_prop(    (    se   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/orm/strategy_options.pyR!   K  s    .
c         C   s  |  j  } | j } | r- |  j | |  } n  | s7 d  S| d } t | t j  rk |  j | | |  } nH t | t  r | j	 } |  j
 | | j | j |  } n t j d   | s d  S| j }	 t |	  }
 | |
 _ |  j |
 _ |
 j  } x@ | D]8 } |
 j |
 j  | d  |  |
 _  } | d  k r d  Sq W|
 j j |  j  |
 j  j ra|
 j  j } n	 |
 j  } |  j r| j | d |
  n | j | d |
  d  S(   Ni    s6   mapper option expects string key or list of attributesR)   (   R   R   R!   R"   R0   R   R6   t   _find_entity_basestringR   R<   t   _find_entity_prop_comparatorR4   t   _parententityR1   R2   t   entity_zeroR   R   RN   RK   R   R$   R/   R5   Ry   t
   setdefaultRD   (   R   R   R   R%   R(   R&   R'   R   R3   RJ   R)   R   t   effective_path(    (    se   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/orm/strategy_options.pyRr   ]  sJ    		
							c         C   s   t  |  r | } n t |  } x | j D] } | j |  r+ | Sq+ W| r t | j  sv t j d | f   q t j d | d j d   | j D  f   n d  Sd  S(   NsJ   Query has only expression-based entities - can't find property named '%s'.s   Can't find property '%s' on any entity specified in this Query.  Note the full path from root (%s) to target entity must be specified.t   ,c         s   s   |  ] } t  |  Vq d  S(   N(   t   str(   t   .0t   x(    (    se   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/orm/strategy_options.pys	   <genexpr>  s   (	   R   R   t   _mapper_entitiest   corresponds_tot   listR1   R2   t   joinR"   (   R   R   R'   R>   R%   t	   searchfort   ent(    (    se   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/orm/strategy_options.pyR     s     	c         C   s   | j  d t  rL t t | j   d k rd | rI t j d   qI qd n | j  t  rd t } n  x5 | j D] } | SW| r t j d | f   n d  Sd  S(   NR_   i   sf   Wildcard loader can only be used with exactly one entity.  Use Load(ent) to specify specific entities.sJ   Query has only expression-based entities - can't find property named '%s'.(
   R7   R   t   lenR   R   R1   R2   R   R   R"   (   R   R   R'   R%   R   (    (    se   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/orm/strategy_options.pyR     s    	(   Rf   Rg   Rh   R   R   Ry   RQ   RK   R[   R^   R   t   classmethodR   R!   Rr   R   R   (    (    (    se   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/orm/strategy_options.pyRi      s   						
				=	t   loader_optionc           B   s,   e  Z d    Z d   Z d   Z d   Z RS(   c         C   s   d  S(   N(    (   R   (    (    se   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/orm/strategy_options.pyR     s    c         C   sO   | j  |  _ } | |  _ t t |  r; t d |   n  t t | |  |  S(   Ns#   Load class already has a %s method.(   Rf   t   namet   fnt   hasattrR   t	   TypeErrort   setattr(   R   R   R   (    (    se   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/orm/strategy_options.pyt   __call__  s    	c         C   s<   | |  _  |  j j } d i |  j d 6|  j _ | | _ |  S(   Ns   Produce a new :class:`.Load` object with the
:func:`.orm.%(name)s` option applied.

See :func:`.orm.%(name)s` for usage examples.

R   (   t   _unbound_fnR   Rh   R   (   R   R   t   fn_doc(    (    se   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/orm/strategy_options.pyt   _add_unbound_fn  s
    		c         C   s$   | |  _  d i |  j d 6| _ |  S(   Ns
  Produce a standalone "all" option for :func:`.orm.%(name)s`.

.. deprecated:: 0.9.0

    The "_all()" style is replaced by method chaining, e.g.::

        session.query(MyClass).options(
            %(name)s("someattribute").%(name)s("anotherattribute")
        )

R   (   t   _unbound_all_fnR   Rh   (   R   R   (    (    se   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/orm/strategy_options.pyt   _add_unbound_all_fn  s    	(   Rf   Rg   R   R   R   R   (    (    (    se   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/orm/strategy_options.pyR     s   				c         C   sf   | d k	 r6 t | t  s6 t |  } | j } q6 n  |  j | i d d 6d t } | | j d <| S(   s  Indicate that the given attribute should be eagerly loaded from
    columns stated manually in the query.

    This function is part of the :class:`.Load` interface and supports
    both method-chained and standalone operation.

    The option is used in conjunction with an explicit join that loads
    the desired rows, i.e.::

        sess.query(Order).\
                join(Order.user).\
                options(contains_eager(Order.user))

    The above query would join from the ``Order`` entity to its related
    ``User`` entity, and the returned ``Order`` objects would have the
    ``Order.user`` attribute pre-populated.

    :func:`contains_eager` also accepts an `alias` argument, which is the
    string name of an alias, an :func:`~sqlalchemy.sql.expression.alias`
    construct, or an :func:`~sqlalchemy.orm.aliased` construct. Use this when
    the eagerly-loaded rows are to come from an aliased table::

        user_alias = aliased(User)
        sess.query(Order).\
                join((user_alias, Order.user)).\
                options(contains_eager(Order.user, alias=user_alias))

    .. seealso::

        :ref:`contains_eager`

    t   joinedt   lazyR8   t   eager_from_aliasN(   R"   R0   R   R   t
   selectableRR   R   R   (   t   loadoptRE   t   aliast   infoR   (    (    se   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/orm/strategy_options.pyt   contains_eager  s    "	c          O   s   t    j t  j |  t |  S(   N(   Ri   R   R   R   (   R{   R}   (    (    se   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/orm/strategy_options.pyR   *  s    	c         G   sL   |  j  | i t d 6t d 6 } | j  d i t d 6t d 6i t d 6 | S(   s  Indicate that for a particular entity, only the given list
    of column-based attribute names should be loaded; all others will be
    deferred.

    This function is part of the :class:`.Load` interface and supports
    both method-chained and standalone operation.

    Example - given a class ``User``, load only the ``name`` and ``fullname``
    attributes::

        session.query(User).options(load_only("name", "fullname"))

    Example - given a relationship ``User.addresses -> Address``, specify
    subquery loading for the ``User.addresses`` collection, but on each
    ``Address`` object load only the ``email_address`` attribute::

        session.query(User).options(
                subqueryload("addreses").load_only("email_address")
        )

    For a :class:`.Query` that has multiple entities, the lead entity can be
    specifically referred to using the :class:`.Load` constructor::

        session.query(User, Address).join(User.addresses).options(
                    Load(User).load_only("name", "fullname"),
                    Load(Address).load_only("email_addres")
                )


    .. versionadded:: 0.9.0

    t   deferredt
   instrumentt   *t   undefer_pks(   RV   R   R   (   R   RT   R   (    (    se   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/orm/strategy_options.pyt	   load_only0  s    "	c          G   s   t    j |    S(   N(   Ri   R   (   RT   (    (    se   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/orm/strategy_options.pyR   \  s    c         C   s9   |  j  | i d d 6 } | d k	 r5 | | j d <n  | S(   s  Indicate that the given attribute should be loaded using joined
    eager loading.

    This function is part of the :class:`.Load` interface and supports
    both method-chained and standalone operation.

    examples::

        # joined-load the "orders" collection on "User"
        query(User).options(joinedload(User.orders))

        # joined-load Order.items and then Item.keywords
        query(Order).options(joinedload(Order.items).joinedload(Item.keywords))

        # lazily load Order.items, but when Items are loaded,
        # joined-load the keywords collection
        query(Order).options(lazyload(Order.items).joinedload(Item.keywords))

    :param innerjoin: if ``True``, indicates that the joined eager load should
     use an inner join instead of the default of left outer join::

        query(Order).options(joinedload(Order.user, innerjoin=True))

     If the joined-eager load is chained onto an existing LEFT OUTER JOIN,
     ``innerjoin=True`` will be bypassed and the join will continue to
     chain as LEFT OUTER JOIN so that the results don't change.  As an
     alternative, specify the value ``"nested"``.  This will instead nest the
     join on the right side, e.g. using the form "a LEFT OUTER JOIN
     (b JOIN c)".

     .. versionadded:: 0.9.4 Added ``innerjoin="nested"`` option to support
        nesting of eager "inner" joins.

    .. note::

        The joins produced by :func:`.orm.joinedload` are **anonymously
        aliased**.  The criteria by which the join proceeds cannot be
        modified, nor can the :class:`.Query` refer to these joins in any way,
        including ordering.

        To produce a specific SQL JOIN which is explicitly available, use
        :meth:`.Query.join`.   To combine explicit JOINs with eager loading
        of collections, use :func:`.orm.contains_eager`; see
        :ref:`contains_eager`.

    .. seealso::

        :ref:`loading_toplevel`

        :ref:`contains_eager`

        :func:`.orm.subqueryload`

        :func:`.orm.lazyload`

        :paramref:`.relationship.lazy`

        :paramref:`.relationship.innerjoin` - :func:`.relationship`-level
        version of the :paramref:`.joinedload.innerjoin` option.

    R   R   t	   innerjoinN(   RR   R"   R   (   R   RE   R   R)   (    (    se   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/orm/strategy_options.pyt
   joinedloada  s    ?c          O   s   t  j t  j |  t |  S(   N(   Ri   R   R   R   (   R{   R}   (    (    se   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/orm/strategy_options.pyR     s    c          O   s   t  j t  j |  t |  S(   N(   Ri   R   R   R   (   R{   R}   (    (    se   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/orm/strategy_options.pyt   joinedload_all  s    c         C   s   |  j  | i d d 6 S(   sA  Indicate that the given attribute should be loaded using
    subquery eager loading.

    This function is part of the :class:`.Load` interface and supports
    both method-chained and standalone operation.

    examples::

        # subquery-load the "orders" collection on "User"
        query(User).options(subqueryload(User.orders))

        # subquery-load Order.items and then Item.keywords
        query(Order).options(subqueryload(Order.items).subqueryload(Item.keywords))

        # lazily load Order.items, but when Items are loaded,
        # subquery-load the keywords collection
        query(Order).options(lazyload(Order.items).subqueryload(Item.keywords))


    .. seealso::

        :ref:`loading_toplevel`

        :func:`.orm.joinedload`

        :func:`.orm.lazyload`

        :paramref:`.relationship.lazy`

    t   subqueryR   (   RR   (   R   RE   (    (    se   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/orm/strategy_options.pyt   subqueryload  s     c          G   s   t  j t  j |  t i   S(   N(   Ri   R   R   R   (   R{   (    (    se   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/orm/strategy_options.pyR     s    c          G   s   t  j t  j |  t i   S(   N(   Ri   R   R   R   (   R{   (    (    se   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/orm/strategy_options.pyt   subqueryload_all  s    c         C   s   |  j  | i d d 6 S(   s  Indicate that the given attribute should be loaded using "lazy"
    loading.

    This function is part of the :class:`.Load` interface and supports
    both method-chained and standalone operation.

    .. seealso::

        :paramref:`.relationship.lazy`

    t   selectR   (   RR   (   R   RE   (    (    se   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/orm/strategy_options.pyt   lazyload  s    c          G   s   t  j t  j |  t i   S(   N(   Ri   R   R   R   (   R{   (    (    se   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/orm/strategy_options.pyR     s    c          G   s   t  j t  j |  t i   S(   N(   Ri   R   R   R   (   R{   (    (    se   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/orm/strategy_options.pyt   lazyload_all  s    c         C   s   |  j  | i d d 6 } | S(   s  Indicate that the given attribute should be loaded using
    an immediate load with a per-attribute SELECT statement.

    This function is part of the :class:`.Load` interface and supports
    both method-chained and standalone operation.

    .. seealso::

        :ref:`loading_toplevel`

        :func:`.orm.joinedload`

        :func:`.orm.lazyload`

        :paramref:`.relationship.lazy`

    t	   immediateR   (   RR   (   R   RE   R)   (    (    se   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/orm/strategy_options.pyt   immediateload  s    c          G   s   t  j t  j |  t i   S(   N(   Ri   R   R   R   (   R{   (    (    se   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/orm/strategy_options.pyR     s    c         C   s   |  j  | i d d 6 S(   sE  Indicate that the given relationship attribute should remain unloaded.

    This function is part of the :class:`.Load` interface and supports
    both method-chained and standalone operation.

    :func:`.orm.noload` applies to :func:`.relationship` attributes; for
    column-based attributes, see :func:`.orm.defer`.

    t   noloadR   (   RR   (   R   RE   (    (    se   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/orm/strategy_options.pyR     s    c          G   s   t  j t  j |  t i   S(   N(   Ri   R   R   R   (   R{   (    (    se   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/orm/strategy_options.pyR   %  s    c         C   s   |  j  | d  S(   s"  Indicate an attribute should load using its default loader style.

    This method is used to link to other loader options, such as
    to set the :func:`.orm.defer` option on a class that is linked to
    a relationship of the parent class being loaded, :func:`.orm.defaultload`
    can be used to navigate this path without changing the loading style
    of the relationship::

        session.query(MyClass).options(defaultload("someattr").defer("some_column"))

    .. seealso::

        :func:`.orm.defer`

        :func:`.orm.undefer`

    N(   RR   R"   (   R   RE   (    (    se   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/orm/strategy_options.pyRx   *  s    c          G   s   t  j t  j |  t i   S(   N(   Ri   R   Rx   R   (   R{   (    (    se   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/orm/strategy_options.pyRx   C  s    c         C   s!   |  j  | f i t d 6t d 6 S(   s  Indicate that the given column-oriented attribute should be deferred, e.g.
    not loaded until accessed.

    This function is part of the :class:`.Load` interface and supports
    both method-chained and standalone operation.

    e.g.::

        from sqlalchemy.orm import defer

        session.query(MyClass).options(
                            defer("attribute_one"),
                            defer("attribute_two"))

        session.query(MyClass).options(
                            defer(MyClass.attribute_one),
                            defer(MyClass.attribute_two))

    To specify a deferred load of an attribute on a related class,
    the path can be specified one token at a time, specifying the loading
    style for each link along the chain.  To leave the loading style
    for a link unchanged, use :func:`.orm.defaultload`::

        session.query(MyClass).options(defaultload("someattr").defer("some_column"))

    A :class:`.Load` object that is present on a certain path can have
    :meth:`.Load.defer` called multiple times, each will operate on the same
    parent entity::


        session.query(MyClass).options(
                        defaultload("someattr").
                            defer("some_column").
                            defer("some_other_column").
                            defer("another_column")
            )

    :param key: Attribute to be deferred.

    :param \*addl_attrs: Deprecated; this option supports the old 0.8 style
     of specifying a path as a series of attributes, which is now superseded
     by the method-chained style.

    .. seealso::

        :ref:`deferred`

        :func:`.orm.undefer`

    R   R   (   RV   R   (   R   R4   (    (    se   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/orm/strategy_options.pyt   deferH  s    4c         G   s    t  j t  j |  f | t i   S(   N(   Ri   R   R   R   (   R4   t
   addl_attrs(    (    se   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/orm/strategy_options.pyR     s    c         C   s!   |  j  | f i t d 6t d 6 S(   s  Indicate that the given column-oriented attribute should be undeferred,
    e.g. specified within the SELECT statement of the entity as a whole.

    The column being undeferred is typically set up on the mapping as a
    :func:`.deferred` attribute.

    This function is part of the :class:`.Load` interface and supports
    both method-chained and standalone operation.

    Examples::

        # undefer two columns
        session.query(MyClass).options(undefer("col1"), undefer("col2"))

        # undefer all columns specific to a single class using Load + *
        session.query(MyClass, MyOtherClass).options(
            Load(MyClass).undefer("*"))

    :param key: Attribute to be undeferred.

    :param \*addl_attrs: Deprecated; this option supports the old 0.8 style
     of specifying a path as a series of attributes, which is now superseded
     by the method-chained style.

    .. seealso::

        :ref:`deferred`

        :func:`.orm.defer`

        :func:`.orm.undefer_group`

    R   R   (   RV   R   R   (   R   R4   (    (    se   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/orm/strategy_options.pyt   undefer  s    #c         G   s    t  j t  j |  f | t i   S(   N(   Ri   R   R   R   (   R4   R   (    (    se   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/orm/strategy_options.pyR     s    c         C   s   |  j  d d i | d 6 S(   s  Indicate that columns within the given deferred group name should be
    undeferred.

    The columns being undeferred are set up on the mapping as
    :func:`.deferred` attributes and include a "group" name.

    E.g::

        session.query(MyClass).options(undefer_group("large_attrs"))

    To undefer a group of attributes on a related entity, the path can be
    spelled out using relationship loader options, such as
    :func:`.orm.defaultload`::

        session.query(MyClass).options(
            defaultload("someattr").undefer_group("large_attrs"))

    .. versionchanged:: 0.9.0 :func:`.orm.undefer_group` is now specific to a
       particiular entity load path.

    .. seealso::

        :ref:`deferred`

        :func:`.orm.defer`

        :func:`.orm.undefer`

    R   t   undefer_groupN(   RV   R"   (   R   R   (    (    se   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/orm/strategy_options.pyR     s    c         C   s   t    j |   S(   N(   Ri   R   (   R   (    (    se   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/orm/strategy_options.pyR     s    N(*   Rh   t
   interfacesR    R   t    R   t   sql.baseR   R   R   R1   R   t   baseR   R   R@   t   path_registryR	   R
   R   R   R   Ri   t   objectR   R"   R   R   R   R   R   R   R   R   R   R   R   R   Rx   R   R   R   (    (    (    se   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/orm/strategy_options.pyt   <module>
   sJ   "*/,D#:)&