
    +he                         d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlm	Z	 dd	lm
Z dd
lmZ ddlmZ ddlmZ ddlmZ ddlmZ  G d de      Z G d de      Z G d de      Z G d de      Zy)zDescriptor properties are more "auxiliary" properties
that exist as configurational elements, but don't participate
as actively in the load/persist ORM loop.

   )
attributes)util)MapperProperty)PropComparator)	_none_set   )event)exc)schema)sql
expression)	operatorsc                   "    e Zd ZdZdZdZdZd Zy)DescriptorPropertyzO:class:`.MapperProperty` which proxies access to a
    user-defined descriptor.NFc                 h      G fddt               } j                  Dt        j                   j                  d       }j                   j                  |      r| _         j                  " fd} fd} fd}t        |||       _         t        j                   j                         j                  j                   j                   j                   fd j                         } | j                        |_        j                  j                   j                  |       y )	Nc                   l    e Zd ZdZdZdZe fd       Zd Z e	W  d      re
j                  f fd	Zyy)7DescriptorProperty.instrument_class.<locals>._ProxyImplFTc                     j                   S N)uses_objectsselfprops    R/var/www/html/venv/lib/python3.12/site-packages/sqlalchemy/orm/descriptor_props.pyr   zDDescriptorProperty.instrument_class.<locals>._ProxyImpl.uses_objects-   s    (((    c                     || _         y r   )key)r   r   s     r   __init__z@DescriptorProperty.instrument_class.<locals>._ProxyImpl.__init__1   s	    r   get_historyc                 *    j                  |||      S r   )r    )r   statedict_passiver   s       r   r    zCDescriptorProperty.instrument_class.<locals>._ProxyImpl.get_history6   s      ++E5'BBr   N)__name__
__module____qualname__accepts_scalar_loaderload_on_unexpire
collectionpropertyr   r   hasattrr   PASSIVE_OFFr    )r   s   r   
_ProxyImplr   (   sM    $)!#J) ) t]+ 1;0F0FC ,r   r.   c                 4    t        | j                  |       y r   )setattrname)objvaluer   s     r   fsetz1DescriptorProperty.instrument_class.<locals>.fsetB   s    TYY.r   c                 2    t        | j                         y r   )delattrr1   r2   r   s    r   fdelz1DescriptorProperty.instrument_class.<locals>.fdelE   s    TYY'r   c                 0    t        | j                        S r   )getattrr1   r7   s    r   fgetz1DescriptorProperty.instrument_class.<locals>.fgetH   s    sDII..r   )r;   r4   r8   c                  &    j                         S r   )_comparator_factory)mapperr   s   r   <lambda>z5DescriptorProperty.instrument_class.<locals>.<lambda>Q   s    D,,V4 r   )docoriginal_property)object
descriptorr:   class_r   _is_userland_descriptorr+   r   create_proxied_attributeparentr@   implclass_managerinstrument_attribute)	r   r>   r.   descr4   r8   r;   
proxy_attrr   s	   ``      @r   instrument_classz#DescriptorProperty.instrument_class%   s    	C 	C& ??"6==$((D9D--dhh="&??"/(/ 'Dt$GDOIZ88IKKHHOO4"

 %TXX.
11$((JGr   )r%   r&   r'   __doc__r@   r   _links_to_entityrM    r   r   r   r      s      CL1Hr   r   c                   8    e Zd ZdZ fdZ fdZd Z e       Zd Z	e
j                  d        Ze
j                  d        Zed        Zd	 Zd
 Ze
j                  d        Zej(                  fdZd Z G d dej0                        Z G d de      Zd Z xZS )CompositePropertyzDefines a "composite" mapped attribute, representing a collection
    of columns as one attribute.

    :class:`.CompositeProperty` is constructed using the :func:`.composite`
    function.

    .. seealso::

        :ref:`mapper_composite`

    c                    t         t        |           || _        || _        |j                  dd      | _        |j                  dd      | _        |j                  dd      | _        |j                  d| j                  j                        | _        d|v r|j                  d      | _        t        j                  |        | j!                          y)a`  Return a composite column-based property for use with a Mapper.

        See the mapping documentation section :ref:`mapper_composite` for a
        full usage example.

        The :class:`.MapperProperty` returned by :func:`.composite`
        is the :class:`.CompositeProperty`.

        :param class\_:
          The "composite type" class, or any classmethod or callable which
          will produce a new instance of the composite object given the
          column values in order.

        :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.  See the same flag on :func:`.column_property`.

        :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 comparator_factory:  a class which extends
          :class:`.CompositeProperty.Comparator` which provides custom SQL
          clause generation for comparison operations.

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

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

        active_historyFdeferredgroupNcomparator_factoryinfo)superrR   r   attrscomposite_classgetrT   rU   rV   pop	__class__
ComparatorrW   rX   r   set_creation_order_create_descriptor)r   rD   rZ   kwargsr^   s       r   r   zCompositeProperty.__init__f   s    V 	/1
%$jj)95A

:u5ZZ.
"(** $..";";#
 V

6*DI%!r   c                 L    t         t        |   |       | j                          y r   )rY   rR   rM   _setup_event_handlers)r   r>   r^   s     r   rM   z"CompositeProperty.instrument_class   s    7?""$r   c                 $    | j                          y)zInitialization which occurs after the :class:`.CompositeProperty`
        has been associated with its parent mapper.

        N)_setup_arguments_on_columnsr   s    r   do_initzCompositeProperty.do_init   s    
 	((*r   c                 H      fd} fd} fd}t        |||       _        y)ztCreate the Python descriptor that will serve as
        the access point on instances of the mapped class.

        c                 
   t        j                  |       }t        j                  |       }j                  |vrj                  D cg c]  }t        | |       }}j                  |vry|j                  t        j                  |      sX j                  | |j                  <   |j                  j                  j                  |j                  j                  g       |j                  j                  d       S c c}w r   )r   instance_dictinstance_stater   _attribute_keysr:   r   
issupersetr[   managerdispatchrefresh_COMPOSITE_FGETr\   )instancer#   r"   r   valuesr   s        r   r;   z2CompositeProperty._create_descriptor.<locals>.fget   s    ,,X6E--h7Exxu$
 7;6J6J/2GHc*  885(II)1E1Ef1M&:d&:&:F&CE$((OMM**22t33dhhZ 99TXXt,,#s   D c                    t        j                  |       }t        j                  |       }|j                  j                     }|j                  j                  t         j                        }|j                  j                  D ]  } |||||j                        } ||j                  <   |j                  D ]  }t        | |d         y t        j                  |j                               D ]  \  }}t        | ||        y r   )r   rk   rl   ro   r   r\   NO_VALUErp   setrH   rm   r0   zip__composite_values__)	rs   r3   r#   r"   attrpreviousfnr   r   s	           r   r4   z2CompositeProperty._create_descriptor.<locals>.fset   s    ,,X6E--h7E==*Dyy:+>+>?Hmm'' >5%499=>#E$((O}// 1CHc401 #&((%*D*D*F# 2JC Hc512r   c                 j   t        j                  |       }t        j                  |       }|j                  j                  t         j
                        }|j                  j                     }|j                  j                  |||j                         j                  D ]  }t        | |d         y r   )r   rl   rk   r]   r   rv   ro   rp   removerH   rm   r0   )rs   r"   r#   r{   rz   r   r   s         r   r8   z2CompositeProperty._create_descriptor.<locals>.fdel   s    --h7E,,X6Eyy:+>+>?H==*DMM  $))<++ -#t,-r   N)r+   rC   )r   r;   r4   r8   s   `   r   ra   z$CompositeProperty._create_descriptor   s$    	-6	2"	- #4t4r   c                     | j                   D cg c],  }t        | j                  j                  |j                        . c}S c c}w r   )propsr:   rG   rD   r   r   s     r   _comparable_elementsz&CompositeProperty._comparable_elements   s/    BF**M$**DHH5MMMs   1Ac                    g }| j                   D ]  }t        |t              r| j                  j	                  |d      }nst        |t
        j                        r| j                  j                  |   }n?t        |t        j                        r|j                  }nt        j                  d|      |j                  |        |S )NF)_configure_mapperszYComposite expects Column objects or mapped attributes/attribute names as arguments, got: )rZ   
isinstancestrrG   get_propertyr   Column_columntopropertyr   InstrumentedAttributer+   sa_excArgumentErrorappend)r   r   rz   r   s       r   r   zCompositeProperty.props   s    JJ 	D$${{///OD&--0{{44T:D*"B"BC}}**  
 LL	 r   c                 v    | j                   D cg c]  }t        |t        j                        s|! c}S c c}w r   )rZ   r   r   r   )r   as     r   columnszCompositeProperty.columns  s'    ::FaAv}})EFFFs   66c                     | j                   D ]H  }| j                  |_        | j                  r| j                  |_        d|_        | j                  |_        J y)zwPropagate configuration arguments made on this composite
        to the target columns, for those that apply.

        ))rU   T)
instrumentTN)r   rT   rU   strategy_keyrV   r   s     r   rf   z-CompositeProperty._setup_arguments_on_columns  sJ    
 JJ 	$D"&"5"5D}} $$N!DJ	$r   c                     fd} fd} fd fd} fd}t        j                   j                  d|d       t        j                   j                  d	|d       t        j                   j                  d
|dd       t        j                   j                  d|dd       t        j                   j                  d|dd       y)z>Establish events that populate/expire the composite attribute.c                      | |d d       y )NF
is_refreshrP   )r"   context_load_refresh_handlers     r   load_handlerz=CompositeProperty._setup_event_handlers.<locals>.load_handler  s    !%$5Ir   c                     |r5j                   hj                  j                        j                  |      r | ||d       y y )NTr   )r   unionrm   intersection)r"   r   to_loadr   r   s      r   refresh_handlerz@CompositeProperty._setup_event_handlers.<locals>.refresh_handler  sF     
  !5!56l7#$ &eWg$O$r   c                    | j                   }|r|j                  u rj                  |v ry j                  D ]  }||vs y   j                  j                  D cg c]  }| j                   |    c} |j                  <   y c c}w r   )dictrr   r   rm   r[   )r"   r   r   r   r#   kr   r   s          r   r   zFCompositeProperty._setup_event_handlers.<locals>._load_refresh_handler   s    JJE 'T-A-A"A((e#
 )) E> 3d22-1-A-ABc%**S/BE$((OBs   Bc                     |$t        j                        j                  |      r'| j                  j	                  j
                  d        y y r   )rw   rm   r   r   r]   r   )r"   keysr   s     r   expire_handlerz?CompositeProperty._setup_event_handlers.<locals>.expire_handler<  s<    |s4#7#78EEdK

txx.  Lr   c                 R    |j                   j                  j                  d       y)zAfter an insert or update, some columns may be expired due
            to server side defaults, or re-populated due to client side
            defaults.  Pop out the composite value here so that it
            recreates.

            N)r   r]   r   )r>   
connectionr"   r   s      r   insert_update_handlerzFCompositeProperty._setup_event_handlers.<locals>.insert_update_handler@  s     JJNN488T*r   after_insertT)rawafter_updateload)r   	propagaterq   expireN)r	   listenrG   )r   r   r   r   r   r   s   `    @r   rd   z'CompositeProperty._setup_event_handlers  s    	J	P	8	/	+ 	KK)>D	
 	KK)>D	
 	KK44	
 	KKO	
 	KK>tt	
r   c                 T    | j                   D cg c]  }|j                   c}S c c}w r   )r   r   r   s     r   rm   z!CompositeProperty._attribute_keys\  s    %)ZZ0T000s   %c                 N   g }g }d}| j                   D ]  }|j                  }|j                  |   j                  j	                  ||      }	|	j                         rd}|	j                         }
|
r|j                  |
       n|j                  d       |	j                  r|j                  |	j                         |j                  d        |r3t        j                   | j                  | gd | j                  | g      S t        j                  d | j                  | gd      S )z>Provided for userland code that uses attributes.get_history().FTNrP   )r   r   ro   rH   r    has_changesnon_deletedextendr   deletedr   Historyr[   )r   r"   r#   r$   addedr   has_historyr   r   histr   s              r   r    zCompositeProperty.get_history`  s    JJ 	%D((C==%**66ueDD!"**,K[)T"||t||,t$	%  %%%%%u-.%%%w/0  %%b+?4+?+?+G*H"MMr   c                 &    | j                  | |      S r   )rW   )r   r>   s     r   r=   z%CompositeProperty._comparator_factory  s    &&tV44r   c                   $     e Zd Z fdZd Z xZS )!CompositeProperty.CompositeBundlec                 d    || _         t        t        j                  |   |j
                  g|  y r   )r+   rY   rR   CompositeBundler   r   )r   	property_exprr^   s      r   r   z*CompositeProperty.CompositeBundle.__init__  s/    %DM#33TC $r   c                       fd}|S )Nc                 h     j                   j                  D cg c]
  } ||        c} S c c}w r   )r+   r[   )rowprocprocsr   s     r   r   zDCompositeProperty.CompositeBundle.create_row_processor.<locals>.proc  s1    4t}}44,12Dd3i2 2s   /rP   )r   queryr   labelsr   s   ` `  r   create_row_processorz6CompositeProperty.CompositeBundle.create_row_processor  s    
 Kr   )r%   r&   r'   r   r   __classcell__r^   s   @r   r   r     s    		r   r   c                       e Zd ZdZdZej                  d        Zd Zej                  d        Z	d Z
ej                  d        Zd Zd	 Zy)
CompositeProperty.Comparatora  Produce boolean, comparison, and other operators for
        :class:`.CompositeProperty` attributes.

        See the example in :ref:`composite_operations` for an overview
        of usage , as well as the documentation for :class:`.PropComparator`.

        .. seealso::

            :class:`.PropComparator`

            :class:`.ColumnOperators`

            :ref:`types_operators`

            :attr:`.TypeEngine.comparator_factory`

        Nc                 @    t        j                  | j                  ddiS )NrV   F)r   
ClauseListr   rg   s    r   clausesz$CompositeProperty.Comparator.clauses  s&    (("77 r   c                     | j                   S r   r   rg   s    r   __clause_element__z/CompositeProperty.Comparator.__clause_element__  s    ??"r   c                     | j                   j                  | j                  | j                  | j                  j                  d      }t
        j                  | j                  |      S )N)parententityparentmapper	proxy_key)r   	_annotate_parententityr   r   rR   r   )r   r   s     r   r   z'CompositeProperty.Comparator.expression  sQ    ll,,$($6$6$($6$6!%G %44TYYHHr   c                    t        |t        j                  j                        r|j                  }|$| j
                  j                  D cg c]  }d  }}nVt        || j
                  j                        r|j                         }n%t        j                  d| j
                  d|      t        | j                  |      S c c}w )Nz!Can't UPDATE composite attribute z to )r   r   elementsBindParameterr3   r   rm   r[   ry   r   r   rx   r   )r   r3   r   rt   s       r   _bulk_update_tuplesz0CompositeProperty.Comparator._bulk_update_tuples  s    %!;!;<}*.))*C*CD3$DDE499#<#<=335**yy%) 
 t00&99 Es   	Cc                     | j                   rL| j                  j                  D cg c],  }t        | j                   j                  |j
                        . c}S | j                  j                  S c c}w r   )_adapt_to_entityr   r   r:   entityr   r   s     r   r   z1CompositeProperty.Comparator._comparable_elements  s`    $$ !%		 > > D1188$((C 
 yy555s   1A/c                 f   |$d gt        | j                  j                        z  }n|j                         }t	        | j                  j                  |      D cg c]
  \  }}||k(   }}}| j
                  r|D cg c]  }| j                  |       }}t        j                  | S c c}}w c c}w r   )	lenr   r   ry   rx   r   adapterr   and_)r   otherrt   r   bcomparisonsxs          r   __eq__z#CompositeProperty.Comparator.__eq__  s    }#dii&D&D"EE335#&tyy'E'Ev#N1aQK  $$8CD1t||ADD88[)) Es   B(<B.c                 J    t        j                  | j                  |            S r   )r   not_r   )r   r   s     r   __ne__z#CompositeProperty.Comparator.__ne__  s    88DKK.//r   )r%   r&   r'   rN   __hash__r   memoized_propertyr   r   r   r   r   r   r   rP   r   r   r_   r     sp    	$ 				 
 	
	# 
			I 
 	I	:  
			6 
 	6
	*	0r   r_   c                 t    t        | j                  j                  j                        dz   | j                  z   S )N.)r   rG   rD   r%   r   rg   s    r   __str__zCompositeProperty.__str__  s+    4;;%%../#5@@r   )r%   r&   r'   rN   r   rM   rh   rB   rr   ra   r   r   r   r   r+   r   rf   rd   rm   r   r-   r    r=   orm_utilBundler   r   r_   r   r   r   s   @r   rR   rR   Y   s    
9"v%+ hO;5z 
N N 
 $ G G
$F
T 
1 1 1;0F0F N@5(// P0^ P0dAr   rR   c                   (     e Zd ZdZd Z fdZ xZS )ConcreteInheritedPropertya4  A 'do nothing' :class:`.MapperProperty` that disables
    an attribute on a concrete subclass that is only present
    on the inherited mapper, not the concrete classes' mapper.

    Cases where this occurs include:

    * When the superclass mapper is mapped against a
      "polymorphic union", which includes all attributes from
      all subclasses.
    * When a relationship() is configured on an inherited mapper,
      but not on the subclass mapper.  Concrete mappers require
      that relationship() is configured explicitly on each
      subclass.

    c                     d }| j                   j                         D ]:  }|j                  | j                     }t	        |t
              r-|j                  } |S  |S r   )rG   iterate_to_root_propsr   r   r   rW   )r   r>   comparator_callablemps        r   r=   z-ConcreteInheritedProperty._comparator_factory  s^    ",,. 	A"Aa!:;&'&:&:#""	
 #"r   c                 t     t         t                    fd G  fddt              } |        _        y )Nc            	      j    t        d j                  d j                  d j                  d      )Nz	Concrete z does not implement attribute z9 at the instance level.  Add this property explicitly to r   )AttributeErrorrG   r   rg   s   r   warnz0ConcreteInheritedProperty.__init__.<locals>.warn  s*      ;;$++7 r   c                   .    e Zd ZfdZfdZ fdZy)DConcreteInheritedProperty.__init__.<locals>.NoninheritedConcretePropc                              y r   rP   )sr2   r3   r   s      r   __set__zLConcreteInheritedProperty.__init__.<locals>.NoninheritedConcreteProp.__set__      r   c                              y r   rP   )r   r2   r   s     r   
__delete__zOConcreteInheritedProperty.__init__.<locals>.NoninheritedConcreteProp.__delete__  r  r   c                 0    |j                   S          y r   )rC   )r   r2   ownerr   r   s      r   __get__zLConcreteInheritedProperty.__init__.<locals>.NoninheritedConcreteProp.__get__  s    ;??*r   N)r%   r&   r'   r  r  r  )r   r   s   r   NoninheritedConcretePropr     s    r   r  )rY   r   r   rB   rC   )r   r  r   r^   s   ` @r   r   z"ConcreteInheritedProperty.__init__  s.    '79	
	v 
	 34r   )r%   r&   r'   rN   r=   r   r   r   s   @r   r   r     s     #5 5r   r   c                        e Zd Z	 	 	 	 	 d fd	Zed        Zej                  d        Zd Z	d Z
 ej                  d      d        Z xZS )	SynonymPropertyc                     t         t        |           || _        || _        || _        || _        |xs |xr |j                  xs d| _        |r|| _	        t        j                  |        y)a  Denote an attribute name as a synonym to a mapped property,
        in that the attribute will mirror the value and expression behavior
        of another attribute.

        e.g.::

            class MyClass(Base):
                __tablename__ = 'my_table'

                id = Column(Integer, primary_key=True)
                job_status = Column(String(50))

                status = synonym("job_status")


        :param name: the name of the existing mapped property.  This
          can refer to the string name ORM-mapped attribute
          configured on the class, including column-bound attributes
          and relationships.

        :param descriptor: a Python :term:`descriptor` that will be used
          as a getter (and potentially a setter) when this attribute is
          accessed at the instance level.

        :param map_column: **For classical mappings and mappings against
          an existing Table object only**.  if ``True``, the :func:`.synonym`
          construct will locate the :class:`_schema.Column`
          object upon the mapped
          table that would normally be associated with the attribute name of
          this synonym, and produce a new :class:`.ColumnProperty` that instead
          maps this :class:`_schema.Column`
          to the alternate name given as the "name"
          argument of the synonym; in this way, the usual step of redefining
          the mapping of the :class:`_schema.Column`
          to be under a different name is
          unnecessary. This is usually intended to be used when a
          :class:`_schema.Column`
          is to be replaced with an attribute that also uses a
          descriptor, that is, in conjunction with the
          :paramref:`.synonym.descriptor` parameter::

            my_table = Table(
                "my_table", metadata,
                Column('id', Integer, primary_key=True),
                Column('job_status', String(50))
            )

            class MyClass(object):
                @property
                def _job_status_descriptor(self):
                    return "Status: %s" % self._job_status


            mapper(
                MyClass, my_table, properties={
                    "job_status": synonym(
                        "_job_status", map_column=True,
                        descriptor=MyClass._job_status_descriptor)
                }
            )

          Above, the attribute named ``_job_status`` is automatically
          mapped to the ``job_status`` column::

            >>> j1 = MyClass()
            >>> j1._job_status = "employed"
            >>> j1.job_status
            Status: employed

          When using Declarative, in order to provide a descriptor in
          conjunction with a synonym, use the
          :func:`sqlalchemy.ext.declarative.synonym_for` helper.  However,
          note that the :ref:`hybrid properties <mapper_hybrids>` feature
          should usually be preferred, particularly when redefining attribute
          behavior.

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

            .. versionadded:: 1.0.0

        :param comparator_factory: A subclass of :class:`.PropComparator`
          that will provide custom comparison behavior at the SQL expression
          level.

          .. note::

            For the use case of providing an attribute which redefines both
            Python-level and SQL-expression level behavior of an attribute,
            please refer to the Hybrid attribute introduced at
            :ref:`mapper_hybrids` for a more effective technique.

        .. seealso::

            :ref:`synonyms` - Overview of synonyms

            :func:`.synonym_for` - a helper oriented towards Declarative

            :ref:`mapper_hybrids` - The Hybrid Attribute extension provides an
            updated approach to augmenting attribute behavior more flexibly
            than can be achieved with synonyms.

        N)rY   r
  r   r1   
map_columnrC   rW   rN   r@   rX   r   r`   )r   r1   r  rC   rW   r@   rX   r^   s          r   r   zSynonymProperty.__init__  sd    ` 	ot-/	$$"4E:<**<*<EDI%r   c                 ~    t        | j                  j                  | j                        j                  j
                  S r   )r:   rG   rD   r1   rH   r   rg   s    r   r   zSynonymProperty.uses_objects  s)    t{{))4995::GGGr   c                    t        | j                  j                  | j                        }t	        |d      rt        |j                  t              st        |t        j                        r|j                  S t        |t        j                        r|S t        j                  d| j                  j                  j                  d| j                  d|      |j                  S )Nr+   zsynonym() attribute "r   z+" only supports ORM mapped attributes, got )r:   rG   rD   r1   r,   r   r+   r   r   QueryableAttribute
comparatorr   ColumnOperatorsr   InvalidRequestErrorr%   )r   rz   s     r   _proxied_objectzSynonymProperty._proxied_object  s    t{{))4995tZ(
MM>1

 $
 = =>&D)";";<,, ;;%%..		4A 
 }}r   c                     | j                   }t        |t              r4| j                  r| j                  ||      }|S |j                  ||      }|S |S r   )r  r   r   rW   )r   r>   r   comps       r   r=   z#SynonymProperty._comparator_factory  sW    ##dN+&&..tV< K ..tV<KKr   c                     t        | j                  j                  | j                        } |j                  j
                  |i |S r   )r:   rG   rD   r1   rH   r    )r   argkwrz   s       r   r    zSynonymProperty.get_history  s8    t{{))4995$tyy$$c0R00r   zsqlalchemy.orm.propertiesc           
      t   t         j                  j                  }| j                  r| j                  |j
                  j                  vrGt        j                  d| j                  d|j
                  j                  d| j                  d      |j
                  j                  | j                     |j                  v r|j                  |j
                  j                  | j                        j                  | j                  k(  rIt        j                  d| j                  d| j                  d| j                  d| j                        |j                  |j
                  j                  | j                           }|j                  | j                  ||d	
       | j                  |_        || _        y )NzCan't compile synonym 'z': no column on table 'z	' named ''z'Can't call map_column=True for synonym =z4, a ColumnProperty already exists keyed to the name z for column T)init	setparent)r   	preloadedorm_propertiesr  r   persist_selectablecr   r   r1   descriptionr   ColumnProperty_configure_property_mapped_by_synonymrG   )r   rG   r  
propertiesr   s        r   
set_parentzSynonymProperty.set_parent  sV   ^^22
??xxv88:::** 		11==  ))++DHH5++,,,--//9#99
 ** xxDIItxxA  ))))++DHH5A &&tyy!$$&O#'88A r   )NNNNN)r%   r&   r'   r   r+   r   r   r   r  r=   r    preload_moduler'  r   r   s   @r   r
  r
    sw     z&x H H 
 &
1 T45# 6#r   r
  N)rN    r   r   r   
interfacesr   r   r   r	   r
   r   r   r   r   r   r   rR   r   r
  rP   r   r   <module>r+     sn      & &        :H :HzLA* LA^25 2 25jL( Lr   