Ë
    èlÖitN  ã                   óÐ   — d dl mZ d dlZd dlmZmZmZmZmZm	Z	m
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mZmZmZ d dlmZmZmZ d	ed
efd„Z G d„ d«      Z G d„ d«      Z y)é    )ÚdeepcopyN)ÚAnyÚDictÚIterableÚListÚOptionalÚSetÚTuple)Ú
fire_eventÚfire_event_if)Ú	lowercase)ÚCacheActionÚCacheDumpGraph)ÚDependentLinkNotCachedErrorÚNewNameAlreadyInCacheErrorÚNoneRelationFoundErrorÚReferencedLinkNotCachedErrorÚ&TruncatedModelNameCausedCollisionError)Ú_ReferenceKeyÚ_make_ref_keyÚ_make_ref_key_dictÚkeyÚreturnc                 ó@   — dj                  t        t        | «      «      S )zfReturn the key in dot-separated string form.

    :param _ReferenceKey key: The key to stringify.
    ú.)ÚjoinÚmapÚstr)r   s    úW/var/www/html/strategist-ai/venv_dbt/lib/python3.12/site-packages/dbt/adapters/cache.pyÚdot_separatedr       s   € ð
 �8‰8”Cœ˜S“MÓ"Ð"ó    c                   ó¶   — e Zd ZdZdd„Zdefd„Zedee   fd„«       Z	edee   fd„«       Z
edee   fd„«       Zd	„ Zd
„ Zd„ Zd„ Zdd„Zd„ Zd„ Zd„ Zd„ Zd„ Zy)Ú_CachedRelationa^  Nothing about _CachedRelation is guaranteed to be thread-safe!

    :attr str schema: The schema of this relation.
    :attr str identifier: The identifier of this relation.
    :attr Dict[_ReferenceKey, _CachedRelation] referenced_by: The relations
        that refer to this relation.
    :attr BaseRelation inner: The underlying dbt relation.
    r   Nc                 ó    — i | _         || _        y ©N)Úreferenced_byÚinner)Úselfr'   s     r   Ú__init__z_CachedRelation.__init__)   s   € ØCEˆÔØˆ�
r!   c                 óz   — dj                  | j                  | j                  | j                  | j                  «      S )Nz@_CachedRelation(database={}, schema={}, identifier={}, inner={}))ÚformatÚdatabaseÚschemaÚ
identifierr'   ©r(   s    r   Ú__str__z_CachedRelation.__str__-   s.   € ØR×ZÑZØ�M‰M˜4Ÿ;™;¨¯©¸¿¹ó
ð 	
r!   c                 ó@   — t        | j                  j                  «      S r%   )r   r'   r,   r/   s    r   r,   z_CachedRelation.database2   s   € ä˜Ÿ™×,Ñ,Ó-Ð-r!   c                 ó@   — t        | j                  j                  «      S r%   )r   r'   r-   r/   s    r   r-   z_CachedRelation.schema6   s   € ä˜Ÿ™×*Ñ*Ó+Ð+r!   c                 ó@   — t        | j                  j                  «      S r%   )r   r'   r.   r/   s    r   r.   z_CachedRelation.identifier:   s   € ä˜Ÿ™×.Ñ.Ó/Ð/r!   c                 ó†   — | j                  | j                  «      }|j                  j                  | j                  «       |S r%   )Ú	__class__r'   Ú__dict__Úupdate)r(   Únews     r   Ú__copy__z_CachedRelation.__copy__>   s/   € Ø�n‰n˜TŸZ™ZÓ(ˆØ�‰×Ñ˜DŸM™MÔ*Øˆ
r!   c                 óÖ   — | j                  | j                  j                  «       «      }|j                  j	                  | j                  «       t        | j                  |«      |_        y r%   )r5   r'   Úincorporater6   r7   r   r&   )r(   Úmemor8   s      r   Ú__deepcopy__z_CachedRelation.__deepcopy__C   sH   € Ø�n‰n˜TŸZ™Z×3Ñ3Ó5Ó6ˆØ�‰×Ñ˜DŸM™MÔ*Ü$ T×%7Ñ%7¸Ó>ˆÕr!   c                 ó   — || j                   v S r%   )r&   )r(   r   s     r   Úis_referenced_byz _CachedRelation.is_referenced_byH   s   € Ø�d×(Ñ(Ð(Ð(r!   c                 ó   — t        | «      S )zuGet the _ReferenceKey that represents this relation

        :return _ReferenceKey: A key for this relation.
        )r   r/   s    r   r   z_CachedRelation.keyK   s   € ô
 ˜TÓ"Ð"r!   c                 ó>   — || j                   |j                  «       <   y)zÞAdd a reference from referrer to self, indicating that if this node
        were drop...cascaded, the referrer would be dropped as well.

        :param _CachedRelation referrer: The node that refers to this node.
        N)r&   r   )r(   Úreferrers     r   Úadd_referencez_CachedRelation.add_referenceR   s   € ð .6ˆ×Ñ˜8Ÿ<™<›>Ò*r!   c                 ó¤   — | j                  «       h}| j                  j                  «       D ]!  }|j                  |j	                  «       «       Œ# |S )zåRecursively collect a set of _ReferenceKeys that would
        consequentially get dropped if this were dropped via
        "drop ... cascade".

        :return Set[_ReferenceKey]: All the relations that would be dropped
        )r   r&   Úvaluesr7   Úcollect_consequences)r(   ÚconsequencesÚrelations      r   rF   z$_CachedRelation.collect_consequencesZ   sN   € ð Ÿ™›
�|ˆØ×*Ñ*×1Ñ1Ó3ò 	AˆHØ×Ñ × =Ñ =Ó ?Õ@ð	AàÐr!   c                 óŠ   — t        | j                  «      t        |«      z  }|D ]  }| j                  j                  |«       Œ y)z¶Non-recursively indicate that an iterable of _ReferenceKey no longer
        exist. Unknown keys are ignored.

        :param Iterable[_ReferenceKey] keys: The keys to drop.
        N)Úsetr&   Úpop)r(   Úkeysr   s      r   Úrelease_referencesz"_CachedRelation.release_referencesf   s@   € ô �4×%Ñ%Ó&¬¨T«Ñ2ˆØò 	(ˆCØ×Ñ×"Ñ" 3Õ'ñ	(r!   c                 óÆ   — | j                   j                  |j                   j                  |j                   j                  |j                   j                  dœ¬«      | _         y)zïRename this cached relation to new_relation.
        Note that this will change the output of key(), all refs must be
        updated!

        :param _CachedRelation new_relation: The new name to apply to the
            relation
        )r,   r-   r.   )ÚpathN)r'   r;   r,   r-   r.   )r(   Únew_relations     r   Úrenamez_CachedRelation.renamep   sQ   € ð —Z‘Z×+Ñ+à(×.Ñ.×7Ñ7Ø&×,Ñ,×3Ñ3Ø*×0Ñ0×;Ñ;ñð ,ó 
ˆ�
r!   c                 óª   — || j                   v rt        ||«      ‚|| j                   vry| j                   j                  |«      }|| j                   |<   y)a�  Rename a reference that may or may not exist. Only handles the
        reference itself, so this is the other half of what `rename` does.

        If old_key is not in referenced_by, this is a no-op.

        :param _ReferenceKey old_key: The old key to be renamed.
        :param _ReferenceKey new_key: The new key to rename to.
        :raises InternalError: If the new key already exists.
        N)r&   r   rK   )r(   Úold_keyÚnew_keyÚvalues       r   Ú
rename_keyz_CachedRelation.rename_key„   sV   € ð �d×(Ñ(Ñ(Ü,¨W°gÓ>Ð>à˜$×,Ñ,Ñ,ØØ×"Ñ"×&Ñ& wÓ/ˆØ&+ˆ×Ñ˜7Ò#r!   c                 óR   — | j                   D �cg c]  }t        |«      ‘Œ c}S c c}w )z‘Return a key/value pair representing this key and its referents.

        return List[str]: The dot-separated form of all referent keys.
        )r&   r    )r(   Úrs     r   Údump_graph_entryz _CachedRelation.dump_graph_entry–   s#   € ð
 +/×*<Ñ*<Ö= Q”˜aÕ Ò=Ð=ùÒ=s   �$)r   N)rB   r#   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r)   r   r0   Úpropertyr   r,   r-   r.   r9   r=   r?   r   rC   rF   rM   rQ   rV   rY   © r!   r   r#   r#      s§   „ ñóð
˜ó 
ð
 ð.˜( 3™-ò .ó ð.ð ð,˜ ™ò ,ó ð,ð ð0˜H S™Mò 0ó ð0òò
?ò
)ò#ó6ò
ò(ò
ò(,ó$>r!   r#   c                   óF  — e Zd ZdZddeddfd„Zdee   dee   ddfd„Zdee   dee   ddfd	„Z	d
e
eee   ef      fd„Zdeee   ef   fd„Zd„ Zdefd„Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zdee   dee   dee   fd„Zd„ Zdee   dee   dee   fd„Zdee   fd„Zy)ÚRelationsCacheaÇ  A cache of the relations known to dbt. Keeps track of relationships
    declared between tables and handles renames/drops as a real database would.

    :attr Dict[_ReferenceKey, _CachedRelation] relations: The known relations.
    :attr threading.RLock lock: The lock around relations, held during updates.
        The adapters also hold this lock while filling the cache.
    :attr Set[str] schemas: The set of known/cached schemas, all lowercased.
    Úlog_cache_eventsr   Nc                 óp   — i | _         t        j                  «       | _        t	        «       | _        || _        y r%   )Ú	relationsÚ	threadingÚRLockÚlockrJ   Úschemasrb   )r(   rb   s     r   r)   zRelationsCache.__init__¨   s(   € Ø?AˆŒÜ—O‘OÓ%ˆŒ	ÜADÃˆŒØ 0ˆÕr!   r,   r-   c                 ób   — | j                   j                  t        |«      t        |«      f«       y)z§Add a schema to the set of known schemas (case-insensitive)

        :param database: The database name to add.
        :param schema: The schema name to add.
        N)rh   Úaddr   )r(   r,   r-   s      r   Ú
add_schemazRelationsCache.add_schema®   s%   € ð 	�‰×Ñœ) HÓ-¬y¸Ó/@ÐAÕBr!   c                 ó  — t        |«      t        |«      f}|| j                  vry| j                  5  | j                  ||«      }| j	                  |«       | j                  j                  |«       ddd«       y# 1 sw Y   yxY w)z–Drop the given schema and remove it from the set of known schemas.

        Then remove all its contents (and their dependents, etc) as well.
        N)r   rh   rg   Ú_list_relations_in_schemaÚ_remove_allÚdiscard)r(   r,   r-   r   Ú	to_removes        r   Údrop_schemazRelationsCache.drop_schemaº   sw   € ô ˜Ó"¤I¨fÓ$5Ð6ˆØ�d—l‘lÑ"Øð
 �Y‰Yñ 	&Ø×6Ñ6°xÀÓHˆIØ×Ñ˜YÔ'à�L‰L× Ñ  Ô%÷		&÷ 	&ñ 	&ús   ²?A:Á:Brh   c                 óH   — | j                   j                  d„ |D «       «       y)z�Add multiple schemas to the set of known schemas (case-insensitive)

        :param schemas: An iterable of the schema names to add.
        c              3   óX   K  — | ]"  \  }}t        |«      |j                  «       f–— Œ$ y ­wr%   )r   Úlower)Ú.0ÚdÚss      r   ú	<genexpr>z0RelationsCache.update_schemas.<locals>.<genexpr>Õ   s#   è ø€ ÒL¹&¸1¸aœY q›\¨1¯7©7«9Ô5ÑLùs   ‚(*N)rh   r7   )r(   rh   s     r   Úupdate_schemaszRelationsCache.update_schemasÐ   s   € ð
 	�‰×ÑÑLÀGÔLÕLr!   Ú	schema_idc                 óZ   — |\  }}t        |«      |j                  «       f| j                  v S )zŸA schema is 'in' the relations cache if it is in the set of cached
        schemas.

        :param schema_id: The db name and schema name to look up.
        )r   rt   rh   )r(   rz   Údbr-   s       r   Ú__contains__zRelationsCache.__contains__×   s+   € ð ‰
ˆˆFÜ˜"“˜vŸ|™|›~Ð.°$·,±,Ð>Ð>r!   c           
      óî   — | j                   5  | j                  j                  «       D ��ci c](  \  }}t        |«      t	        |j                  «       «      “Œ* c}}cddd«       S c c}}w # 1 sw Y   yxY w)z¨Dump a key-only representation of the schema to a dictionary. Every
        known relation is a key with a value of a list of keys it is referenced
        by.
        N)rg   rd   Úitemsr    r   rY   )r(   ÚkÚvs      r   Ú
dump_graphzRelationsCache.dump_graphà   sd   € ð �Y‰Yñ 	dØLPÏNÉN×L`ÑL`ÓLb×cÁDÀAÀq”M !Ó$¤c¨!×*<Ñ*<Ó*>Ó&?Ñ?Óc÷	dñ 	dùÛc÷	dð 	dús   �A+«-A%ÁA+Á%A+Á+A4rH   c                 ó¦   — | j                  |j                  |j                  «       |j                  «       }| j                  j                  ||«      S )zîAdd a relation to the cache, or return it if it already exists.

        :param _CachedRelation relation: The relation to set or get.
        :return _CachedRelation: The relation stored under the given relation's
            key
        )rk   r,   r-   r   rd   Ú
setdefault)r(   rH   r   s      r   Ú_setdefaultzRelationsCache._setdefaultë   s>   € ð 	�‰˜×)Ñ)¨8¯?©?Ô;Ø�l‰l‹nˆØ�~‰~×(Ñ(¨¨hÓ7Ð7r!   c                 óÔ   — | j                   j                  |«      }|€y|€t        |«      ‚| j                   j                  |«      }|€t        |«      ‚|€J ‚|j	                  |«       y)a¿  Add a link between two relations to the database. Both the old and
        new entries must alraedy exist in the database.

        :param _ReferenceKey referenced_key: The key identifying the referenced
            model (the one that if dropped will drop the dependent model).
        :param _ReferenceKey dependent_key: The key identifying the dependent
            model.
        :raises InternalError: If either entry does not exist.
        N)rd   Úgetr   r   rC   )r(   Úreferenced_keyÚdependent_keyÚ
referencedÚ	dependents        r   Ú	_add_linkzRelationsCache._add_linkö   sq   € ð —^‘^×'Ñ'¨Ó7ˆ
ØÐØØÐÜ.¨~Ó>Ð>à—N‘N×&Ñ& }Ó5ˆ	ØÐÜ-¨mÓ<Ð<àÐ$Ð$Ð$à× Ñ  Õ+r!   c                 ó‚  — t        |«      }t        |«      }|j                  |j                  f| vr3t        t	        |j                  «       |j                  «       ¬«      «       y|| j                  vr-|j                  |j                  ¬«      }| j                  |«       || j                  vr-|j                  |j                  ¬«      }| j                  |«       t        t	        d|j                  «       |j                  «       ¬«      «       | j                  5  | j                  ||«       ddd«       y# 1 sw Y   yxY w)ar  Add a link between two relations to the database. If either relation
        does not exist, it will be added as an "external" relation.

        The dependent model refers _to_ the referenced model. So, given
        arguments of (jake_test, bar, jake_test, foo):
        both values are in the schema jake_test and foo is a view that refers
        to bar, so "drop bar cascade" will drop foo and all of foo's
        dependents.

        :param BaseRelation referenced: The referenced model.
        :param BaseRelation dependent: The dependent model.
        :raises InternalError: If either entry does not exist.
        )Úref_keyÚ	ref_key_2N)ÚtypeÚadd_link©ÚactionrŽ   r�   )r   r,   r-   r   r   Ú_asdictrd   ÚreplaceÚExternalrj   rg   rŒ   )r(   rŠ   r‹   rŽ   Údep_keys        r   r‘   zRelationsCache.add_link  s  € ô   
Ó+ˆÜ 	Ó*ˆØ×Ñ˜gŸn™nÐ-°TÑ9ô ÜØ#ŸO™OÓ-Ø%Ÿo™oÓ/ôôð Ø˜$Ÿ.™.Ñ(à#×+Ñ+°×1DÑ1DÐ+ÓEˆJØ�H‰H�ZÔ Ø˜$Ÿ.™.Ñ(à!×)Ñ)¨z×/BÑ/BÐ)ÓCˆIØ�H‰H�YÔÜÜØ!ØŸ™Ó)Ø!Ÿ/™/Ó+ôô	
ð �Y‰Yñ 	-Ø�N‰N˜7 GÔ,÷	-÷ 	-ñ 	-ús   ÄD5Ä5D>c                 ó"  ‡ — t        |«      }t        ‰ j                  ˆ fd„«       t        t	        dt        |«      ¬«      «       ‰ j                  5  ‰ j                  |«       ddd«       t        ‰ j                  ˆ fd„«       y# 1 sw Y   Œ#xY w)z§Add the relation inner to the cache, under the schema schema and
        identifier identifier

        :param BaseRelation relation: The underlying relation.
        c                  ó<   •— t        dd‰ j                  «       ¬«      S )NÚbeforeÚadding©Úbefore_afterr“   Údump©r   r‚   r/   s   €r   ú<lambda>z$RelationsCache.add.<locals>.<lambda>E  ó   ø€ ”N°ÀÐPT×P_ÑP_ÓPaÔb€ r!   Úadd_relation©r“   rŽ   Nc                  ó<   •— t        dd‰ j                  «       ¬«      S )NÚafterr›   rœ   rŸ   r/   s   €r   r    z$RelationsCache.add.<locals>.<lambda>M  ó   ø€ ”N°ÀÈtÏÉÓO`Ôa€ r!   )r#   r   rb   r   r   r   rg   r…   )r(   rH   Úcacheds   `  r   rj   zRelationsCache.add<  sy   ø€ ô ! Ó*ˆÜØ×!Ñ!Ûbô	
ô 	”; nÔ>PÐQWÓ>XÔYÔZà�Y‰Yñ 	%Ø×Ñ˜VÔ$÷	%äØ×!Ñ!Ûaõ	
÷	%ð 	%ús   ÁBÂBc                 óŒ   — |D ]  }| j                   |= Œ | j                   j                  «       D ]  }|j                  |«       Œ y)z˜Removes all references to all entries in keys. This does not
        cascade!

        :param Iterable[_ReferenceKey] keys: The keys to remove.
        N)rd   rE   rM   )r(   rL   r   r§   s       r   Ú_remove_refszRelationsCache._remove_refsP  sK   € ð ò 	$ˆCØ—‘˜sÑ#ð	$ð —n‘n×+Ñ+Ó-ò 	,ˆFØ×%Ñ% dÕ+ñ	,r!   c                 óÈ  — t        |«      }t        |«      }t        t        d|¬«      «       | j                  5  || j
                  vr t        t        d|¬«      «       	 ddd«       y| j
                  |   j                  «       }|D �cg c]  }|j                  «       ‘Œ }}t        t        d||¬«      «       | j                  |«       ddd«       yc c}w # 1 sw Y   yxY w)a›  Drop the named relation and cascade it appropriately to all
        dependent relations.

        Because dbt proactively does many `drop relation if exist ... cascade`
        that are noops, nonexistent relation drops cause a debug log and no
        other actions.

        :param str schema: The schema of the relation to drop.
        :param str identifier: The identifier of the relation to drop.
        Údrop_relationr£   Údrop_missing_relationNÚdrop_cascade)r“   rŽ   Úref_list)	r   r   r   r   rg   rd   rF   r”   r©   )r(   rH   Údropped_keyÚdropped_key_msgrG   r   Úconsequence_msgss          r   ÚdropzRelationsCache.drop]  sÓ   € ô $ HÓ-ˆÜ,¨XÓ6ˆÜ”; o¸ÔOÔPØ�Y‰Yñ 	,Ø $§.¡.Ñ0Üœ;Ð.EÈÔ_Ô`Ø÷	,ð 	,ð  Ÿ>™>¨+Ñ6×KÑKÓMˆLà9EÖF°# §¡¥ÐFÐÐFÜÜØ)Ø+Ø-ôôð ×Ñ˜lÔ+÷	,ð 	,ùò  G÷	,ð 	,ús#   ¹&CÁ(!CÂ	CÂ *CÃCÃC!c                 óî  — | j                   j                  |«      }|j                  «       }|j                  |«       | j                   j	                  «       D ]g  }|j                  |«      sŒt        t        dt        |«      t        |«      t        |j                  «       «      ¬«      «       |j                  ||«       Œi || j                   |<   | j                  |j                  |j                  «       y)a  Rename a relation named old_key to new_key, updating references.
        Return whether or not there was a key to rename.

        :param _ReferenceKey old_key: The existing key, to rename from.
        :param _CachedRelation new_key: The new relation, to rename to.
        Úupdate_reference)r“   rŽ   r�   Ú	ref_key_3T)rd   rK   r   rQ   rE   r?   r   r   r   rV   rk   r,   r-   )r(   rS   rP   rH   rT   r§   s         r   Ú_rename_relationzRelationsCache._rename_relation{  sÌ   € ð —>‘>×%Ñ% gÓ.ˆØ×"Ñ"Ó$ˆð 	�‰˜Ô%à—n‘n×+Ñ+Ó-ò 	4ˆFØ×&Ñ& wÕ/ÜÜØ1Ü 2°7Ó ;Ü"4°WÓ"=Ü"4°V·Z±Z³\Ó"Bô	ôð ×!Ñ! '¨7Õ3ð	4ð #+ˆ�‰�wÑà�‰˜×(Ñ(¨'¯.©.Ô9àr!   c                 ó²   — || j                   v rt        || j                   «      ‚|| j                   vr%t        t        d|j	                  «       ¬«      «       yy)a  Check the rename constraints, and return whether or not the rename
        can proceed.

        If the new key is already present, that is an error.
        If the old key is absent, we debug log and return False, assuming it's
        a temp table being renamed.

        :param _ReferenceKey old_key: The existing key, to rename from.
        :param _ReferenceKey new_key: The new key, to rename to.
        :return bool: If the old relation exists for renaming.
        :raises InternalError: If the new key is already present.
        Útemporary_relationr£   FT)rd   r   r   r   r”   )r(   rS   rT   s      r   Ú_check_rename_constraintsz(RelationsCache._check_rename_constraintsŸ  sL   € ð �d—n‘nÑ$ô 9¸À$Ç.Á.ÓQÐQà˜$Ÿ.™.Ñ(Ü”{Ð*>ÈÏÉÓHYÔZÔ[ØØr!   c                 óÎ  ‡ — t        |«      }t        |«      }t        t        d|j                  «       |j                  «       ¬«      «       t	        ‰ j
                  ˆ fd„«       ‰ j                  5  ‰ j                  ||«      r‰ j                  |t        |«      «       n‰ j                  t        |«      «       ddd«       t	        ‰ j
                  ˆ fd„«       y# 1 sw Y   Œ#xY w)a  Rename the old schema/identifier to the new schema/identifier and
        update references.

        If the new schema/identifier is already present, that is an error.
        If the schema/identifier key is absent, we only debug log and return,
        assuming it's a temp table being renamed.

        :param BaseRelation old: The existing relation name information.
        :param BaseRelation new: The new relation name information.
        :raises InternalError: If the new key is already present.
        Úrename_relationr’   c                  ó<   •— t        dd‰ j                  «       ¬«      S )Nrš   rQ   rœ   rŸ   r/   s   €r   r    z'RelationsCache.rename.<locals>.<lambda>Í  r¡   r!   Nc                  ó<   •— t        dd‰ j                  «       ¬«      S )Nr¥   rQ   rœ   rŸ   r/   s   €r   r    z'RelationsCache.rename.<locals>.<lambda>Ø  r¦   r!   )r   r   r   r”   r   rb   rg   r¹   r¶   r#   r…   )r(   Úoldr8   rS   rT   s   `    r   rQ   zRelationsCache.rename¶  sÂ   ø€ ô   Ó$ˆÜ Ó$ˆÜÜØ(ØŸ™Ó)Ø!Ÿ/™/Ó+ôô	
ô 	Ø×!Ñ!Ûbô	
ð
 �Y‰Yñ 	7Ø×-Ñ-¨g°wÔ?Ø×%Ñ% g¬¸sÓ/CÕDà× Ñ ¤°Ó!5Ô6÷		7ô 	Ø×!Ñ!Ûaõ	
÷	7ð 	7ús   Á0A	CÃC$c                 ó\  — t        |«      }t        |«      }| j                  5  | j                  j                  «       D �cg c]>  }t        |j                  «      |k(  r$t        |j
                  «      |k(  r|j                  ‘Œ@ }}ddd«       dv r
t        «       ‚|S c c}w # 1 sw Y   ŒxY w)zñCase-insensitively yield all relations matching the given schema.

        :param str schema: The case-insensitive schema name to list from.
        :return List[BaseRelation]: The list of relations with the given
            schema
        N)r   rg   rd   rE   r-   r,   r'   r   )r(   r,   r-   rX   Úresultss        r   Úget_relationszRelationsCache.get_relationsÛ  s¡   € ô ˜XÓ&ˆÜ˜6Ó"ˆØ�Y‰Yñ 	ð Ÿ™×.Ñ.Ó0öàÜ˜aŸh™hÓ'¨6Ò1´iÀÇ
Á
Ó6KÈxÒ6Wð —“ðˆGð ÷	ð �7‰?Ü(Ó*Ð*Øˆùò÷	ð 	ús   £B"Á ABÂB"ÂB"Â"B+c                 ó®   — | j                   5  | j                  j                  «        | j                  j                  «        ddd«       y# 1 sw Y   yxY w)zClear the cacheN)rg   rd   Úclearrh   r/   s    r   rÃ   zRelationsCache.clearï  s>   € à�Y‰Yñ 	!Ø�N‰N× Ñ Ô"Ø�L‰L×ÑÔ ÷	!÷ 	!ñ 	!ús   �5AÁAc                 óÔ   — t        |«      t        |«      f}g }| j                  j                  «       D ]2  \  }}|j                  |j                  f|k(  sŒ"|j                  |«       Œ4 |S )z<Get the relations in a schema. Callers should hold the lock.)r   rd   r   r,   r-   Úappend)r(   r,   r-   r   rp   ÚcachekeyrH   s          r   rm   z(RelationsCache._list_relations_in_schemaõ  sk   € ô ˜Ó"¤I¨fÓ$5Ð6ˆà+-ˆ	Ø"&§.¡.×"6Ñ"6Ó"8ò 	+ÑˆH�hØ×!Ñ! 8§?¡?Ð3°sÓ:Ø× Ñ  Õ*ð	+ð Ðr!   rp   c                 óh   — |D ]-  }t        |«      }|| j                  v sŒ| j                  |«       Œ/ y)z_Remove all the listed relations. Ignore relations that have been
        cascaded out.
        N)r   rd   r²   )r(   rp   rH   Údrop_keys       r   rn   zRelationsCache._remove_all  s5   € ð "ò 	$ˆHä$ XÓ.ˆHØ˜4Ÿ>™>Ò)Ø—	‘	˜(Õ#ñ		$r!   )F)rZ   r[   r\   r]   Úboolr)   r   r   rk   rq   r   r
   ry   r}   r‚   r#   r…   rŒ   r‘   rj   r©   r²   r¶   r¹   rQ   r   r   rÁ   rÃ   rm   rn   r_   r!   r   ra   ra   ž   sO  „ ññ1¨ð 1¸$ó 1ð
Cà˜3‘-ð
Cð ˜‘ð
Cð 
ó	
Cð&à˜3‘-ð&ð ˜‘ð&ð 
ó	&ð,M h¨u°X¸c±]ÀCÐ5GÑ/HÑ&Ió Mð? e¨H°S©M¸3Ð,>Ñ&?ó ?ò	dð	8 Oó 	8ò,ò2+-òZ
ò(,ò,ò<"òHò.#
ðJ h¨s¡mð ¸XÀc¹]ð ÈtÐTWÉyó ò(!ð
Ø  ™ð
Ø/7¸©}ð
à	ˆoÑ	ó
ð$ T¨/Ñ%:ô $r!   ra   )!Úcopyr   re   Útypingr   r   r   r   r   r	   r
   Údbt_common.events.functionsr   r   Údbt_common.utils.formattingr   Údbt.adapters.events.typesr   r   Údbt.adapters.exceptions.cacher   r   r   r   r   Údbt.adapters.reference_keysr   r   r   r   r    r#   ra   r_   r!   r   ú<module>rÑ      s]   ðÝ Û ß B× BÑ Bç AÝ 1ç A÷õ ÷ñ ð#�}ð #¨ó #÷|>ñ |>÷~k$ò k$r!   