관리-도구
편집 파일: ddl.cpython-311.pyc
� �܋fӢ � � � d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlm Z dd lm Z dd lmZ ddlmZ G d� d e� � Z G d� dee � � Z G d� de� � Z G d� de� � Z G d� de� � Z G d� de� � Z G d� de� � Z G d� de� � Z G d� de � � Z G d� de� � Z G d � d!e� � Z G d"� d#e� � Z G d$� d%e� � Z G d&� d'e� � Z G d(� d)e� � Z G d*� d+e� � Z G d,� d-e� � Z G d.� d/e� � Z G d0� d1e� � Z G d2� d3e� � Z G d4� d5e� � Z! G d6� d7e!� � Z" G d8� d9e!� � Z# d>d;�Z$ d?d=�Z%d:S )@zq Provides the hierarchy of DDL-defining schema items as well as routines to invoke them for a create/drop call. � )�_bind_or_error)�_generative)� Executable)� SchemaVisitor)� ClauseElement� )�event)�exc)�util)�topologicalc � � e Zd Zd� ZdS )�_DDLCompilesc � � |j || fi |��S )zNReturn a compiler appropriate for this ClauseElement, given a Dialect.)�ddl_compiler)�self�dialect�kws �I/opt/cloudlinux/venv/lib64/python3.11/site-packages/sqlalchemy/sql/ddl.py� _compilerz_DDLCompiles._compiler s! � � $�w�#�G�T�8�8�R�8�8�8� N)�__name__� __module__�__qualname__r � r r r r s# � � � � � �9� 9� 9� 9� 9r r c � � e Zd ZdZej � ddi� � ZdZdZdZ dZ d� Zdd�Z e j dd� � d � � � Zed � � � Zedd�� � Zd� Zd � Zd� Zd� Zd� Zd� Z eee� � Zd� ZdS )� DDLElementa� Base class for DDL expression constructs. This class is the base for the general purpose :class:`.DDL` class, as well as the various create/drop clause constructs such as :class:`.CreateTable`, :class:`.DropTable`, :class:`.AddConstraint`, etc. :class:`.DDLElement` integrates closely with SQLAlchemy events, introduced in :ref:`event_toplevel`. An instance of one is itself an event receiving callable:: event.listen( users, 'after_create', AddConstraint(constraint).execute_if(dialect='postgresql') ) .. seealso:: :class:`.DDL` :class:`.DDLEvents` :ref:`event_toplevel` :ref:`schema_ddl_sequences` � autocommitTNc �0 � |� | ||� � S �N)�_execute_ddl)r � connection�multiparams�paramss r �_execute_on_connectionz!DDLElement._execute_on_connectionG s � ��&�&�t�[�&�A�A�Ar c �� � |�t | � � }| � ||� � r(|� | � |� � � � S |j j � d� � dS )a1 Execute this DDL immediately. Executes the DDL statement in isolation using the supplied :class:`.Connectable` or :class:`.Connectable` assigned to the ``.bind`` property, if not supplied. If the DDL has a conditional ``on`` criteria, it will be invoked with None as the event. :param bind: Optional, an ``Engine`` or ``Connection``. If not supplied, a valid :class:`.Connectable` must be present in the ``.bind`` property. :param target: Optional, defaults to None. The target :class:`_schema.SchemaItem` for the execute call. Will be passed to the ``on`` callable if any, and may also provide string expansion data for the statement. See ``execute_at`` for more information. Nz(DDL execution skipped, criteria not met.)r �_should_execute�execute�against�engine�logger�info)r �bind�targets r r'