Ë
    S>{ix  ã                   óŠ   — d dl mZ d dlmZ d dlmZmZ d dlmZ 	 d dl	m
Z
 erd dlmZ d dlmZ d	„ Zy
# e$ r	  ed«      ‚w xY w)é    )Úabsolute_import)ÚTYPE_CHECKING)Úcache_statementÚshould_run_explain_plan)ÚDidNotEnable)ÚtextzSQLAlchemy not installed.)ÚAny)ÚSpanc                 óT  — |j                  «       j                  «       j                  d«      syt        ||«      sy|j	                  dd«      rdnd}d|z  |z   |z  }|j                  t        |«      «      }|D �cg c]  }|‘Œ }	}| j                  d|	«       t        ||«       yc c}w )	aB  
    Run EXPLAIN or EXPLAIN ANALYZE on the given statement and attach the explain plan to the span data.

    Usage:
    ```
    sentry_sdk.init(
        dsn="...",
        _experiments={
            "attach_explain_plans": {
                "explain_cache_size": 1000,  # Run explain plan for the 1000 most run queries
                "explain_cache_timeout_seconds": 60 * 60 * 24,  # Run the explain plan for each statement only every 24 hours
                "use_explain_analyze": True,  # Run "explain analyze" instead of only "explain"
            }
        }
    ```
    ÚSELECTNÚuse_explain_analyzeFÚANALYZEÚ zEXPLAIN %s zdb.explain_plan)	ÚstripÚupperÚ
startswithr   ÚgetÚexecuter   Úset_datar   )
ÚspanÚ
connectionÚ	statementÚ
parametersÚoptionsÚanalyzeÚexplain_statementÚresultÚrowÚexplain_plans
             úc/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/sentry_sdk/db/explain_plan/sqlalchemy.pyÚattach_explain_plan_to_spanr!      s£   € ð$ �?‰?Ó×"Ñ"Ó$×/Ñ/°Ô9Øä" 9¨gÔ6Øà"Ÿ;™;Ð'<¸eÔD‰iÈ"€GØ'¨'Ñ1°YÑ>À*ÑLÐà×Ñ¤Ð%6Ó 7Ó8€FØ#)Ö*˜C’CÐ*€LÐ*à‡M�MÐ# \Ô2Ü�I˜wÕ'ùò +s   Á;	B%N)Ú
__future__r   Úsentry_sdk.constsr   Úsentry_sdk.db.explain_planr   r   Úsentry_sdk.integrationsr   Úsqlalchemy.sqlr   ÚImportErrorÚtypingr	   Úsentry_sdk.tracingr
   r!   © ó    r    ú<module>r,      sF   ðÝ &å +ß OÝ 0ð4Ý#ñ Ýå'ó(øð ò 4Ù
Ð2Ó
3Ð3ð4ús	   œ4 ´A