✏️ 正在编辑: utils.cpython-312.pyc
路径:
/var/opt/nydus/ops/mysql/ai/utils/__pycache__/utils.cpython-312.pyc
提示:
您可以编辑任何文件(包括二进制文件),但请注意不当修改可能导致文件损坏。
� ��'j�E � � � d Z ddlZddlZddlZddlZddlZddlmZ ddlm Z m Z mZmZm Z mZmZmZ ddlZddlZddlmZ ddlmZ ddlmZ ddlmZ d Zd Zddd ddd�Zd Z dee! de!fd�Z"ededee#e$e%e%f fd�� Z& d1dede%deddfd�Z'de%fd�Z(d2de e%ge)f de*de%fd�Z+de dee%e e f fd�Z,dedejZ fd �Z.ded!e%d"e%dejZ fd#�Z/ded!e%d"e%de)fd$�Z0ded!e%d"e%ddfd%�Z1 d1ded!e%d"e%d&ejZ d'ee%e%f ddfd(�Z2ded!e%d&ejZ dee%e%f fd)�Z3d*e%de%fd+�Z4dede%fd,�Z5ded!e%d"e%de)fd-�Z6 d3d.eeejZ ejn ejp f d/e%deejZ fd0�Z9y)4a. General utilities for AI features in MySQL Connector/Python. Includes helpers for: - defensive dict copying - temporary table lifecycle management - SQL execution and result conversions - DataFrame to/from SQL table utilities - schema/table/column name validation - array-like to DataFrame conversion � N)�contextmanager)�Any�Callable�Dict�Iterator�List�Optional�Tuple�Union)�atomic_transaction)�MySQLConnectionAbstract)�MySQLCursorAbstract)�ParamsSequenceOrDictType�mysql_ai� �BIGINT�DOUBLE�LONGTEXT�BOOLEAN�DATETIME)�int64�float64�object�boolzdatetime64[ns]�options�returnc �4 � | �i S t j | � S )z� Make a defensive copy of a dictionary, or return an empty dict if None. Args: options: param dict or None Returns: dict )�copy�deepcopy)r s �E/opt/nydus/tmp/pip-target-k0fmikie/lib/python/mysql/ai/utils/utils.py� copy_dictr! I s � � ��� ��=�=��!�!� � db_connectionc # � K � g } |�� t | � 5 }|D ] \ }}t |||� � ddd� y# 1 sw Y yxY w# t | � 5 }|D ] \ }}t |||� � ddd� w # 1 sw Y w xY wxY w�w)a Context manager to track and automatically clean up temporary SQL tables. Args: db_connection: Database connection object used to create and delete tables. Returns: None Raises: DatabaseError: If a database connection issue occurs. If an operational error occurs during execution. Yields: temporary_tables: List of (schema_name, table_name) tuples created during the context. All tables in this list are deleted on context exit. N)r �delete_sql_table)r# �temporary_tables�cursor�schema_name� table_names r �temporary_sql_tablesr* Y s{ � �� �, /1��B��� � � .�&�+;�'��Z� ���j�A� ,<� /� .� .�� � � .�&�+;�'��Z� ���j�A� ,<� /� .� .�sF �B �A �B �7� B �A �B �A=�A1�( A=�1A:�6A=�=B r'