관리-도구
편집 파일: sqlalchemy.cpython-311.pyc
� �܋f� � �( � d dl mZ d dlmZ d dlmZ d dlmZ d dlm Z d dl mZmZ d dl mZ d dlmZ d d lmZ d d lmZ d dlmZ n# e$ r ed� � �w xY werd d lmZ d dlmZ d dlmZ d dlmZ G d� de� � Zd� Z d� Z!d� Z"d� Z#d� Z$dS )� )�absolute_import�� text_type)� TYPE_CHECKING)�SPANDATA)�Hub)�Integration�DidNotEnable)�record_sql_queries)� parse_version)�Engine)�listen)�__version__zSQLAlchemy not installed.)�Any)�ContextManager)�Optional)�Spanc �( � e Zd ZdZed� � � ZdS )�SqlalchemyIntegration� sqlalchemyc �L � t t � � } | �'t d� t � � � � �| dk rt d� � �t t dt � � t t dt � � t t dt � � d S )Nz!Unparsable SQLAlchemy version: {})� � z!SQLAlchemy 1.2 or newer required.�before_cursor_execute�after_cursor_execute�handle_error) r �SQLALCHEMY_VERSIONr �formatr r �_before_cursor_execute�_after_cursor_execute� _handle_error)�versions �Y/opt/cloudlinux/venv/lib64/python3.11/site-packages/sentry_sdk/integrations/sqlalchemy.py� setup_oncez SqlalchemyIntegration.setup_once s� � � � 2�3�3���?��3�:�:�;M�N�N�� � � �V����B�C�C�C��v�.�0F�G�G�G��v�-�/D�E�E�E��v�~�}�5�5�5�5�5� N)�__name__� __module__�__qualname__� identifier�staticmethodr$ � r% r# r r s2 � � � � � ��J��6� 6� �\�6� 6� 6r% r c � � t j }|� t � � �d S t |||||r|j r|j j pd |�� � }||_ |� � � } | �t | | � � | |_ d S d S )N)� paramstyle�executemany)r �current�get_integrationr r �dialectr- �_sentry_sql_span_manager� __enter__�_set_db_data�_sentry_sql_span) �conn�cursor� statement� parameters�contextr. �args�hub�ctx_mgr�spans r# r r 1 s� � � �+�C� ���0�1�1�9��� ������M�w��M�7�?�3M�U�QU�� � � �G� (/�G�$������D����T�4� � � �#'�� � � � �r% c �l � t |dd � � }|� d |_ |� d d d � � d S d S )Nr2 )�getattrr2 �__exit__)r6 r7 r8 r9 r: r; r= s r# r r J sO � ���+�T�� �G� ��+/��(�����t�T�*�*�*�*�*� �r% c �� � | j }|�d S t |dd � � }|�|� d� � t |dd � � }|� d |_ |� d d d � � d S d S )Nr5 �internal_errorr2 )�execution_contextr@ � set_statusr2 rA )r: r; rD r>