관리-도구
편집 파일: unitofwork.cpython-311.pyc
� �܋f�` � � � d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlm Z d � Z G d � de� � Z G d� d e� � Z G d� de � � Z G d� de� � Z G d� de e� � Z G d� de� � Z G d� de� � Z G d� de� � Z G d� de� � Z G d� de� � Z G d� de� � Zd S )!z�The internals for the unit of work system. The session's flush() process passes objects to a contextual object here, which assembles flush tasks based on mappers and their properties, organizes them in order of dependency, and executes. � �� attributes)�exc)�persistence)�util� )�event)�topologicalc �� �� |j ��fd�}�fd�}�fd�}t j | d|dd�� � t j | d|dd�� � t j | d|dd�� � d S ) z\Establish event listeners on object attributes which handle cascade-on-set/append. c �@ �� |�d S | j }|r�|j r|� d� � | j j j � }t j |� � }|j j r<|j s�|j k r*|� |� � s|� |� � |S )Nzcollection append)�session�_warn_on_events�_flush_warning�manager�mapper�_propsr �instance_state�_cascade�save_update�cascade_backrefs�key�_contains_state�_save_or_update_state��state�item� initiator�sess�prop� item_stater s ��P/opt/cloudlinux/venv/lib64/python3.11/site-packages/sqlalchemy/orm/unitofwork.py�appendz$track_cascade_events.<locals>.append s� �� � �<��F��}��� 7��#� 9��#�#�$7�8�8�8��=�'�.�s�3�D�#�2�4�8�8�J�� �)� 7��*� 7�.1�Y�]�.B�.B��,�,�Z�8�8� /C� �*�*�:�6�6�6��� c � �� |�d S | j }| j j j � }|r%|j r|� |j rdnd� � |��|t j uru|t j uri|j j r_t j |� � }|j � |� � r3|r ||j v r|� |� � d S d|_ d S d S d S d S d S d S )Nzcollection removezrelated attribute deleteT)r r r r r r �uselistr � NEVER_SET�PASSIVE_NO_RESULTr � delete_orphanr � _is_orphan�_new�expunge�_orphaned_outside_of_sessionr s �r! �removez$track_cascade_events.<locals>.remove6 s# �� ��<��F��}���}�#�*�3�/��� �D�(� �����<�0�#�#�/� � � � ���J�0�0�0��J�8�8�8�� �+� 9� $�2�4�8�8�J��{�%�%�j�1�1� C�� C�J�$�)�3�3��L�L��&�&�&�&�&� ?C�J�;�;�;�! ��0�0�8�8�8�8� C� Cr# c �6 �� ||u r|S | j }|�r|j r|� d� � | j j j � }|�\t j |� � }|j j r<|j s�|j k r*|� |� � s|� |� � |�t|t j urf|t j urX|j j rLt j |� � }||j v r/|j � |� � r|� |� � |S )Nzrelated attribute set)r r r r r r r r r r r r r r r&