Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/sqlalchemy/engine/__pycache__/interfaces.cpython-39.pyc
Ðазад
a _�hk� � @ s| d Z ddlmZ ddlmZ ddlmZ G dd� de�ZG dd� de�ZG d d � d e�Z G dd� de�Z G d d� de�ZdS )z1Define core interfaces used by the engine system.� )�util)�Compiled)�TypeCompilerc @ s� e Zd ZdZdZdd� Zedd� �Zdd� Zd d � Z didd �Z e�dd�djdd��Z dkdd�Zdldd�Zdmdd�Zdndd�Zdodd�Zdpdd�Zdqdd�Zdrd d!�Zdsd"d#�Zdtd$d%�Zdud&d'�Zd(d)� Zd*d+� Zdvd,d-�Zdwd.d/�Zd0d1� Zd2d3� Zd4d5� Zd6d7� Z d8d9� Z!d:d;� Z"d<d=� Z#d>d?� Z$d@dA� Z%dBdC� Z&dDdE� Z'dFdG� Z(dxdIdJ�Z)dydKdL�Z*dMdN� Z+dzdOdP�Z,d{dQdR�Z-d|dSdT�Z.dUdV� Z/dWdX� Z0dYdZ� Z1d[d\� Z2d]d^� Z3d_d`� Z4dadb� Z5edcdd� �Z6ededf� �Z7edgdh� �Z8dS )}�Dialecta� Define the behavior of a specific database and DB-API combination. Any aspect of metadata definition, SQL query generation, execution, result-set handling, or anything else which varies between databases is defined under the general category of the Dialect. The Dialect acts as a factory for other database-specific object implementations including ExecutionContext, Compiled, DefaultGenerator, and TypeEngine. .. note:: Third party dialects should not subclass :class:`.Dialect` directly. Instead, subclass :class:`.default.DefaultDialect` or descendant class. All dialects include the following attributes. There are many other attributes that may be supported as well: ``name`` identifying name for the dialect from a DBAPI-neutral point of view (i.e. 'sqlite') ``driver`` identifying name for the dialect's DBAPI ``positional`` True if the paramstyle for this Dialect is positional. ``paramstyle`` the paramstyle to be used (some DB-APIs support multiple paramstyles). ``encoding`` type of encoding to use for unicode, usually defaults to 'utf-8'. ``statement_compiler`` a :class:`.Compiled` class used to compile SQL statements ``ddl_compiler`` a :class:`.Compiled` class used to compile DDL statements ``server_version_info`` a tuple containing a version number for the DB backend in use. This value is only available for supporting dialects, and is typically populated during the initial connection to the database. ``default_schema_name`` the name of the default schema. This value is only available for supporting dialects, and is typically populated during the initial connection to the database. ``execution_ctx_cls`` a :class:`.ExecutionContext` class used to handle statement execution ``execute_sequence_format`` either the 'tuple' or 'list' type, depending on what cursor.execute() accepts for the second argument (they vary). ``preparer`` a :class:`~sqlalchemy.sql.compiler.IdentifierPreparer` class used to quote identifiers. ``supports_alter`` ``True`` if the database supports ``ALTER TABLE`` - used only for generating foreign key constraints in certain circumstances ``max_identifier_length`` The maximum length of identifier names. ``supports_sane_rowcount`` Indicate whether the dialect properly implements rowcount for ``UPDATE`` and ``DELETE`` statements. ``supports_sane_multi_rowcount`` Indicate whether the dialect properly implements rowcount for ``UPDATE`` and ``DELETE`` statements when executed via executemany. ``preexecute_autoincrement_sequences`` True if 'implicit' primary key functions must be executed separately in order to get their value. This is currently oriented towards PostgreSQL. ``implicit_returning`` use RETURNING or equivalent during INSERT execution in order to load newly generated primary keys and other column defaults in one execution, which are then available via inserted_primary_key. If an insert statement has returning() specified explicitly, the "implicit" functionality is not used and inserted_primary_key will not be available. ``colspecs`` A dictionary of TypeEngine classes from sqlalchemy.types mapped to subclasses that are specific to the dialect class. This dictionary is class-level only and is not accessed from the dialect instance itself. ``supports_default_values`` Indicates if the construct ``INSERT INTO tablename DEFAULT VALUES`` is supported ``supports_sequences`` Indicates if the dialect supports CREATE SEQUENCE or similar. ``sequences_optional`` If True, indicates if the "optional" flag on the Sequence() construct should signal to not generate a CREATE SEQUENCE. Applies only to dialects that support sequences. Currently used only to allow PostgreSQL SERIAL to be used on a column that specifies Sequence() for usage on other backends. ``supports_native_enum`` Indicates if the dialect supports a native ENUM construct. This will prevent types.Enum from generating a CHECK constraint when that type is used. ``supports_native_boolean`` Indicates if the dialect supports a native boolean construct. This will prevent types.Boolean from generating a CHECK constraint when that type is used. ``dbapi_exception_translation_map`` A dictionary of names that will contain as values the names of pep-249 exceptions ("IntegrityError", "OperationalError", etc) keyed to alternate class names, to support the case where a DBAPI has exception classes that aren't named as they are referred to (e.g. IntegrityError = MyException). In the vast majority of cases this dictionary is empty. .. versionadded:: 1.0.5 Fc C s t � �dS )a� Build DB-API compatible connection arguments. Given a :class:`.URL` object, returns a tuple consisting of a ``(*args, **kwargs)`` suitable to send directly to the dbapi's connect function. The arguments are sent to the :meth:`.Dialect.connect` method which then runs the DBAPI-level ``connect()`` function. The method typically makes use of the :meth:`.URL.translate_connect_args` method in order to generate a dictionary of options. The default implementation is:: def create_connect_args(self, url): opts = url.translate_connect_args() opts.update(url.query) return [[], opts] :param url: a :class:`.URL` object :return: a tuple of ``(*args, **kwargs)`` which will be passed to the :meth:`.Dialect.connect` method. .. seealso:: :meth:`.URL.translate_connect_args` N��NotImplementedError)�self�url� r ��/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/sqlalchemy/engine/interfaces.py�create_connect_args� s zDialect.create_connect_argsc C s t � �dS )a4 Transform a generic type to a dialect-specific type. Dialect classes will usually use the :func:`_types.adapt_type` function in the types module to accomplish this. The returned result is cached *per dialect class* so can contain no dialect-instance state. Nr )�clsZtypeobjr r r �type_descriptor� s zDialect.type_descriptorc C s dS )a� Called during strategized creation of the dialect with a connection. Allows dialects to configure options based on server version info or other properties. The connection passed here is a SQLAlchemy Connection object, with full capabilities. The initialize() method of the base dialect should be called via super(). Nr �r � connectionr r r � initialize� s zDialect.initializec C s t � �dS )a� Load table description from the database. Given a :class:`_engine.Connection` and a :class:`~sqlalchemy.schema.Table` object, reflect its columns and properties from the database. The implementation of this method is provided by :meth:`.DefaultDialect.reflecttable`, which makes use of :class:`_reflection.Inspector` to retrieve column information. Dialects should **not** seek to implement this method, and should instead implement individual schema inspection operations such as :meth:`.Dialect.get_columns`, :meth:`.Dialect.get_pk_constraint`, etc. Nr )r r �tableZinclude_columnsZexclude_columnsZresolve_fksr r r �reflecttable� s zDialect.reflecttableNc K s t � �dS )a7 Return information about columns in `table_name`. Given a :class:`_engine.Connection`, a string `table_name`, and an optional string `schema`, return column information as a list of dictionaries with these keys: * ``name`` - the column's name * ``type`` - [sqlalchemy.types#TypeEngine] * ``nullable`` - boolean * ``default`` - the column's default value * ``autoincrement`` - boolean * ``sequence`` - a dictionary of the form {'name' : str, 'start' :int, 'increment': int, 'minvalue': int, 'maxvalue': int, 'nominvalue': bool, 'nomaxvalue': bool, 'cycle': bool, 'cache': int, 'order': bool} Additional column attributes may be present. Nr �r r � table_name�schema�kwr r r �get_columns� s zDialect.get_columnsz0.8z�The :meth:`.Dialect.get_primary_keys` method is deprecated and will be removed in a future release. Please refer to the :meth:`.Dialect.get_pk_constraint` method. c K s t � �dS )z6Return information about primary keys in `table_name`.Nr r r r r �get_primary_keys s zDialect.get_primary_keysc K s t � �dS )a� Return information about the primary key constraint on table_name`. Given a :class:`_engine.Connection`, a string `table_name`, and an optional string `schema`, return primary key information as a dictionary with these keys: * ``constrained_columns`` - a list of column names that make up the primary key * ``name`` - optional name of the primary key constraint. Nr r r r r �get_pk_constraint s zDialect.get_pk_constraintc K s t � �dS )a� Return information about foreign_keys in `table_name`. Given a :class:`_engine.Connection`, a string `table_name`, and an optional string `schema`, return foreign key information as a list of dicts with these keys: * ``name`` - the constraint's name * ``constrained_columns`` - a list of column names that make up the foreign key * ``referred_schema`` - the name of the referred schema * ``referred_table`` - the name of the referred table * ``referred_columns`` - a list of column names in the referred table that correspond to constrained_columns Nr r r r r �get_foreign_keys+ s zDialect.get_foreign_keysc K s t � �dS )z*Return a list of table names for `schema`.Nr �r r r r r r r �get_table_namesE s zDialect.get_table_namesc K s t � �dS )zyReturn a list of temporary table names on the given connection, if supported by the underlying backend. Nr r r r r �get_temp_table_namesJ s zDialect.get_temp_table_namesc K s t � �dS )z�Return a list of all view names available in the database. :param schema: Optional, retrieve names from a non-default schema. Nr r r r r �get_view_namesR s zDialect.get_view_namesc K s t � �dS )zxReturn a list of temporary view names on the given connection, if supported by the underlying backend. Nr r r r r �get_temp_view_names[ s zDialect.get_temp_view_namesc K s t � �dS )z�Return view definition. Given a :class:`_engine.Connection`, a string `view_name`, and an optional string `schema`, return the view definition. Nr )r r Z view_namer r r r r �get_view_definitionc s zDialect.get_view_definitionc K s t � �dS )a� Return information about indexes in `table_name`. Given a :class:`_engine.Connection`, a string `table_name` and an optional string `schema`, return index information as a list of dictionaries with these keys: * ``name`` - the index's name * ``column_names`` - list of column names in order * ``unique`` - boolean Nr r r r r �get_indexesm s zDialect.get_indexesc K s t � �dS )a� Return information about unique constraints in `table_name`. Given a string `table_name` and an optional string `schema`, return unique constraint information as a list of dicts with these keys: * ``name`` - the unique constraint's name * ``column_names`` - list of column names in order * ``**kw`` - other options passed to the dialect's get_unique_constraints() method. .. versionadded:: 0.9.0 Nr r r r r �get_unique_constraints� s zDialect.get_unique_constraintsc K s t � �dS )a� Return information about check constraints in `table_name`. Given a string `table_name` and an optional string `schema`, return check constraint information as a list of dicts with these keys: * ``name`` - the check constraint's name * ``sqltext`` - the check constraint's SQL expression * ``**kw`` - other options passed to the dialect's get_check_constraints() method. .. versionadded:: 1.1.0 Nr r r r r �get_check_constraints� s zDialect.get_check_constraintsc K s t � �dS )a| Return the "comment" for the table identified by `table_name`. Given a string `table_name` and an optional string `schema`, return table comment information as a dictionary with this key: text text of the comment Raises ``NotImplementedError`` for dialects that don't support comments. .. versionadded:: 1.2 Nr r r r r �get_table_comment� s zDialect.get_table_commentc C s t � �dS )z�convert the given name to lowercase if it is detected as case insensitive. This method is only used if the dialect defines requires_name_normalize=True. Nr �r �namer r r �normalize_name� s zDialect.normalize_namec C s t � �dS )z�convert the given name to a case insensitive identifier for the backend if it is an all-lowercase name. This method is only used if the dialect defines requires_name_normalize=True. Nr r&