Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
contego / home / tvault / .virtenv / lib / python2.7 / site-packages / sqlalchemy / orm / properties.pyc
Size: Mime:
ó
‹EYc@@sªdZddlmZddlmZmZddlmZddlmZddlm	Z	dd	l
mZmZd
ddd
dgZ
ejd
efd„ƒYƒZdS(szMapperProperty implementations.

This is a private module which defines the behavior of invidual ORM-
mapped attributes.

i(tabsolute_importi(tutiltlog(t
expressioni(t
attributes(t_orm_full_deannotate(tPropComparatortStrategizedPropertytColumnPropertytCompositePropertytSynonymPropertytComparablePropertytRelationshipPropertycB@s¥eZdZdZd Zd„Zejddƒd„ƒZe	d„ƒZ
d„Zd„Zd„Z
ejd„Zd„Zdejefd„ƒYZd„ZRS(!sDescribes an object attribute that corresponds to a table column.

    Public constructor is the :func:`.orm.column_property` function.

    tcolumnt
_orig_columnstcolumnstgrouptdeferredt
instrumenttcomparator_factoryt
descriptort	extensiontactive_historytexpire_on_flushtinfotdoctstrategy_classt_creation_ordert_is_polymorphic_discriminatort_mapped_by_synonymt_deferred_column_loadercO@stt|ƒjƒg|D]}tj|ƒ^q|_g|D]}tjt|ƒƒ^q?|_|jddƒ|_
|jdtƒ|_|jdt
ƒ|_|jd|jjƒ|_|jddƒ|_|jddƒ|_|jdtƒ|_|jdt
ƒ|_d	|kr2|jd	ƒ|_nd
|krS|jd
ƒ|_nNxKt|jƒD]1}t|d
dƒ}|dk	rc||_PqcqcWd|_|rÛtd|jjdjt|jƒƒƒfƒ‚ntj |ƒ|j!d|jfd
|jfƒ|_"dS(s!
Provide a column-level property for use with a Mapper.

        Column-based properties can normally be applied to the mapper's
        ``properties`` dictionary using the :class:`.Column` element directly.
        Use this function when the given column is not directly present within
        the mapper's selectable; examples include SQL expressions, functions,
        and scalar SELECT queries.

        Columns that aren't present in the mapper's selectable won't be
        persisted by the mapper and are effectively "read-only" attributes.

        :param \*cols:
              list of Column objects to be mapped.

        :param active_history=False:
          When ``True``, indicates that the "previous" value for a
          scalar attribute should be loaded when replaced, if not
          already loaded. Normally, history tracking logic for
          simple non-primary-key scalar values only needs to be
          aware of the "new" value in order to perform a flush. This
          flag is available for applications that make use of
          :func:`.attributes.get_history` or :meth:`.Session.is_modified`
          which also need to know
          the "previous" value of the attribute.

          .. versionadded:: 0.6.6

        :param comparator_factory: a class which extends
           :class:`.ColumnProperty.Comparator` which provides custom SQL
           clause generation for comparison operations.

        :param group:
            a group name for this property when marked as deferred.

        :param deferred:
              when True, the column property is "deferred", meaning that
              it does not load immediately, and is instead loaded when the
              attribute is first accessed on an instance.  See also
              :func:`~sqlalchemy.orm.deferred`.

        :param doc:
              optional string that will be applied as the doc on the
              class-bound descriptor.

        :param expire_on_flush=True:
            Disable expiry on flush.   A column_property() which refers
            to a SQL expression (and not a single table-bound column)
            is considered to be a "read only" property; populating it
            has no effect on the state of data, and it can only return
            database state.   For this reason a column_property()'s value
            is expired whenever the parent object is involved in a
            flush, that is, has any kind of "dirty" state within a flush.
            Setting this parameter to ``False`` will have the effect of
            leaving any existing value present after the flush proceeds.
            Note however that the :class:`.Session` with default expiration
            settings still expires
            all attributes after a :meth:`.Session.commit` call, however.

            .. versionadded:: 0.7.3

        :param info: Optional data dictionary which will be populated into the
            :attr:`.MapperProperty.info` attribute of this object.

            .. versionadded:: 0.8

        :param extension:
            an
            :class:`.AttributeExtension`
            instance, or list of extensions, which will be prepended
            to the list of attribute listeners for the resulting
            descriptor placed on the class.
            **Deprecated.** Please see :class:`.AttributeEvents`.

        RRt_instrumentRRRRRRRs.%s received unexpected keyword argument(s): %ss, RN(#tsuperRt__init__Rt_labeledRRRtpoptNoneRtFalseRtTrueRt	__class__t
ComparatorRRRRRRRtreversedtgetattrt	TypeErrort__name__tjointsortedtkeysRtset_creation_ordert_strategy_lookupR(tselfRtkwargstctcolR((sN/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/properties.pyR!,s@K%(				%
ssqlalchemy.orm.statessqlalchemy.orm.strategiescC@s+|jj|jj|j|jƒ|jƒS(N(t
InstanceStatet"_instance_level_callable_processortparentt
class_managertLoadDeferredColumnstkey(R2tstatet
strategies((sN/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/properties.pyt&_memoized_attr__deferred_column_loader s		cC@s|jdS(sJReturn the primary column or expression for this ColumnProperty.

        i(R(R2((sN/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/properties.pyR¦sc	C@sH|js
dStj|j|jd|j||ƒd|d|jƒdS(Nt
comparatortparententityR(RRtregister_descriptortclass_R;RR(R2tmapper((sN/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/properties.pytinstrument_class­s		cC@s~tt|ƒjƒt|jƒdkrzt|jjƒj|jƒrzt	j
d|j|jd|jd|jfƒndS(Nis¼On mapper %s, primary key column '%s' is being combined with distinct primary key column '%s' in attribute '%s'.  Use explicit properties to give each column its own mapped attribute name.i(R Rtdo_inittlenRtsetR8tprimary_keyt
issupersetRtwarnR;(R2((sN/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/properties.pyRE¹scC@s(td|jd|jd|j|jŒS(NRRR(RRRRR(R2((sN/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/properties.pytcopyÄs
		cC@s"|j|jƒj||d|ƒS(Ntpassive(tget_implR;tget_committed_value(R2R<tdict_R
RL((sN/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/properties.pyt
_getcommittedËsc
C@sŸ|js
dS|j|krj||j}|s?|||j<q›|j|jƒ}	|	j|||dƒn1|jr›|j|kr›|j||jgƒndS(N(RR;RMRGR$thas_identityt_expire_attributes(
R2tsessiontsource_statetsource_dictt
dest_statet	dest_dicttloadt
_recursivetvaluetimpl((sN/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/properties.pytmergeÐs	
R(cB@sAeZdZdZd„Zd„Zd„Zd„Zd„ZRS(	smProduce boolean, comparison, and other operators for
        :class:`.ColumnProperty` attributes.

        See the documentation for :class:`.PropComparator` for a brief
        overview.

        See also:

        :class:`.PropComparator`

        :class:`.ColumnOperators`

        :ref:`types_operators`

        :attr:`.TypeEngine.comparator_factory`

        t__clause_element__RcC@sO|jr |j|jjdƒS|jjdji|jd6|jd6ƒSdS(NiR@tparentmapper(tadaptertpropRt	_annotatet
_parententity(R2((sN/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/properties.pyt#_memoized_method___clause_element__ôs
	
cC@s6|jƒ}y|jSWntk
r1|jjSXdS(N(R]RtAttributeErrorR`(R2tce((sN/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/properties.pyt_memoized_attr_infoþs

cC@st|jƒ|ƒS(s‡proxy attribute access down to the mapped column.

            this allows user-defined comparison methods to be accessed.
            (R*R](R2R;((sN/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/properties.pyt_fallback_getattrscO@s||jƒ||ŽS(N(R](R2toptotherR3((sN/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/properties.pytoperatescK@s(|jƒ}||j||ƒ||S(N(R]t_bind_param(R2RhRiR3R5((sN/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/properties.pytreverse_operates(s__clause_element__sinfo(	R,t
__module__t__doc__t	__slots__RcRfRgRjRl(((sN/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/properties.pyR(ßs	
			cC@st|jjjƒd|jS(Nt.(tstrR8RBR,R;(R2((sN/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/properties.pyt__str__s(s
_orig_columnsscolumnssgroupsdeferreds
instrumentscomparator_factorys
descriptors	extensionsactive_historysexpire_on_flushsinfosdocsstrategy_classs_creation_orders_is_polymorphic_discriminators_mapped_by_synonyms_deferred_column_loader(R,RmRntstrategy_wildcard_keyRoR!RtdependenciesR>tpropertyRRDRERKRtPASSIVE_OFFRPR\t
MemoizedSlotsRR(Rr(((sN/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/properties.pyRs"	t				4N(Rnt
__future__RtRRtsqlRRRt
interfacesRRt__all__tclass_loggerR(((sN/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/properties.pyt<module>
s