L i dZddlmZddlmZddlmZddlmZddlmZddlm Z ddlm Z dd lm Z dd lm Z dd lm Z dd lmZdd lmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddl m!Z!ddl m!Z!ddl m"Z"ddl m"Z"ddlm#Z#ddl$m%Z%dd l&m'Z'dd!l&m(Z(dd"l&m)Z)dd#l&m*Z*erd$d%l+m,Z,d$d&l+m-Z-d$d'l.m/Z/d$d(l0m1Z1dd)l2m3Z3dd*lm4Z4dd+lm5Z5dd,l6m7Z7dd-l8m9Z9dd.l m:Z:dd/l m;Z;dd0l mZ>dd3l m?Z?dd4l@mAZAdd5l@mBZBdd6lCmDZDdd7lCmEZEdd8lCmFZFddlCmZGdd9lHmIZIdd:lJmKZKdd;lJmLZLdd?ZQGd@dAeZRGdBdCeZSGdDdEe)ZTGdFdGe)ZUGdHdIe)ZVGdJdKe)ZWeeOefZXeeOefZYeeXZZeeZeXfZ[eeeeXfZ\eeeeeZfZ]ee]e\fZ^eeeOdIee_ee_ee_ee_ee`fZae\Zbe]Zce^ZdeedLfZeeeeOeeOfZfe#eOefZge'dMZheeeOedNfZie'dOZjGdPdQe*dRSZke#eOefZleekeeOeffZmGdTdUe*ZnGdVdWe*ZoGdXdYe*ZpGdZd[e*ZqGd\d]eqZrGd^d_eqZsGd`daeqZtGdbdceqZuGdddee*ZvGdfdge*ZwGdhdieZxeee_eOfdjfZyeeeOeOfZzGdkdleZ{GdmdnZ|GdodpZ}GdqdreZ~e~ZGdsdtZGdudvZyw)xz1Define core interfaces used by the engine system.) annotations)Enum)Any) Awaitable)Callable)ClassVar) Collection)Dict)Iterable)Iterator)List)Mapping)MutableMapping)Optional)Sequence)Set)Tuple)Type) TYPE_CHECKING)TypeVar)Union)util) EventTarget)Pool)PoolProxiedConnection)Compiled) TypeCompiler) immutabledict) await_only)Literal) NotRequired)Protocol) TypedDict) Connection)Engine) CursorResult)URL)AsyncIODBAPIConnection)_ListenerFnType) dispatcher)StatementError) Executable)_InsertManyValuesBatch) DDLCompiler)IdentifierPreparer)InsertmanyvaluesSentinelOpts)Linting) SQLCompiler) BindParameter) ClauseElement)Column)DefaultGenerator) SchemaItem)Integer) _TypeMemoDict) TypeEngine)generic_fn_descriptor_Tr)boundc eZdZdZdZdZdZdZy) CacheStatsrr%rN)__name__ __module__ __qualname__ CACHE_HIT CACHE_MISSCACHING_DISABLED NO_CACHE_KEYNO_DIALECT_SUPPORTb/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/sqlalchemy/engine/interfaces.pyrArAPsIJLrMrAc eZdZdZdZ dZ dZy) ExecuteStylezVindicates the :term:`DBAPI` cursor method that will be used to invoke a statement.rr%rN)rDrErF__doc__EXECUTE EXECUTEMANYINSERTMANYVALUESrLrMrNrPrPXs$G1K6rMrPcleZdZGddeZGddeZGddeZGddeZd d Zy ) DBAPIModuleceZdZddZy)DBAPIModule.ErrorcyNrLselfkeys rN __getattr__zDBAPIModule.Error.__getattr__prMNr]strreturnr)rDrErFr^rLrMrNErrorrXos3rMrcc eZdZy)DBAPIModule.OperationalErrorNrDrErFrLrMrNOperationalErrorrer rMrgc eZdZy)DBAPIModule.InterfaceErrorNrfrLrMrNInterfaceErrorrjurhrMrkc eZdZy)DBAPIModule.IntegrityErrorNrfrLrMrNIntegrityErrorrmxrhrMrncyrZrLr[s rNr^zDBAPIModule.__getattr__{r_rMNr`) rDrErF Exceptionrcrgrkrnr^rLrMrNrVrVns74 4 5     0rMrVc@eZdZdZd dZd dZd dZd dZd dZd dZ y) DBAPIConnectionzprotocol representing a :pep:`249` database connection. .. versionadded:: 2.0 .. seealso:: `Connection Objects `_ - in :pep:`249` cyrZrLr\s rNclosezDBAPIConnection.closer_rMcyrZrLrts rNcommitzDBAPIConnection.commitr_rMcyrZrL)r\argskwargss rNcursorzDBAPIConnection.cursorr_rMcyrZrLrts rNrollbackzDBAPIConnection.rollbackr_rMcyrZrLr[s rNr^zDBAPIConnection.__getattr__r_rMcyrZrL)r\r]values rN __setattr__zDBAPIConnection.__setattr__r_rMNrbNone)ryrrzrrb DBAPICursorr`)r]rarrrbr) rDrErFrQrurwr{r}r^rrLrMrNrrrr~s !!C#/`_ - in :pep:`249` N)rDrErFrQrLrMrNrrs rMrceZdZUdZe ddZeddZded<ded<ddZ d dd Z dd Z dd Z ddd Z dd Z ddZddZ d ddZd dZd!dZy)"rzprotocol representing a :pep:`249` database cursor. .. versionadded:: 2.0 .. seealso:: `Cursor Objects `_ - in :pep:`249` cy)zThe description attribute of the Cursor. .. seealso:: `cursor.description `_ - in :pep:`249` NrLrts rN descriptionzDBAPICursor.descriptions rMintcyrZrLrts rNrowcountzDBAPICursor.rowcounts"rM arraysize lastrowidcyrZrLrts rNruzDBAPICursor.closer_rMNcyrZrLr\ operation parameterss rNexecutezDBAPICursor.executerMcyrZrLrs rN executemanyzDBAPICursor.executemanyrrMcyrZrLrts rNfetchonezDBAPICursor.fetchoner_rMcyrZrL)r\sizes rN fetchmanyzDBAPICursor.fetchmanyr_rMcyrZrLrts rNfetchallzDBAPICursor.fetchallr_rMcyrZrL)r\sizess rN setinputsizeszDBAPICursor.setinputsizesr_rMcyrZrL)r\rcolumns rN setoutputsizezDBAPICursor.setoutputsizer_rMcyrZrL)r\procnamers rNcallproczDBAPICursor.callprocsrMcyrZrLrts rNnextsetzDBAPICursor.nextsetr_rMcyrZrLr[s rNr^zDBAPICursor.__getattr__r_rM)rb_DBAPICursorDescription)rbrrrZ)rrr#Optional[_DBAPISingleExecuteParams]rbr)rrr_DBAPIMultiExecuteParamsrbr)rbz Optional[Any]).)rrrb Sequence[Any])rbr)rrrbr)rrrrrbr)rrarrrbr)rbzOptional[bool]r`)rDrErFrQpropertyrr__annotations__rurrrrrrrrrr^rLrMrNrrs       ""NN ;?8  -  ->,>@:=)6 -/rMrr)qmarknumericnamedformatpyformatnumeric_dollarTypeEngine[Any]) SERIALIZABLEzREPEATABLE READzREAD COMMITTEDzREAD UNCOMMITTED AUTOCOMMITcreZdZUded<ded<ded<ded<ded <d ed <d ed <d ed <ded<ded<y)_CoreKnownExecutionOptionszOptional[CompiledCacheType]compiled_cachera logging_tokenIsolationLevelisolation_levelbool no_parametersstream_resultsrmax_row_buffer yield_perinsertmanyvalues_page_sizez Optional[SchemaTranslateMapType]schema_translate_mappreserve_rowcountN)rDrErFrrLrMrNrrs=//##N ##::rMrF)totalceZdZUdZded< ded< ded< ded< ded< ded < ded < ded < ded < d ed< ded<y)ReflectedIdentitya&represent the reflected IDENTITY structure of a column, corresponding to the :class:`_schema.Identity` construct. The :class:`.ReflectedIdentity` structure is part of the :class:`.ReflectedColumn` structure, which is returned by the :meth:`.Inspector.get_columns` method. ralwayson_nullrstart incrementminvaluemaxvalue nominvalue nomaxvaluecycle Optional[int]cacheorderNrDrErFrQrrLrMrNrr-sl L! M J(N)M,M,++ K% 1 K-rMrc(eZdZUdZded< ded<y)ReflectedComputeda%Represent the reflected elements of a computed column, corresponding to the :class:`_schema.Computed` construct. The :class:`.ReflectedComputed` structure is part of the :class:`.ReflectedColumn` structure, which is returned by the :meth:`.Inspector.get_columns` method. rasqltextNotRequired[bool] persistedNrrLrMrNrr[sL"! MrMrc|eZdZUdZded< ded< ded< ded < d ed < d ed < ded< ded< ded<y)ReflectedColumnzDictionary representing the reflected elements corresponding to a :class:`_schema.Column` object. The :class:`.ReflectedColumn` structure is returned by the :class:`.Inspector.get_columns` method. ranamertypernullable Optional[str]defaultr autoincrementNotRequired[Optional[str]]commentzNotRequired[ReflectedComputed]computedzNotRequired[ReflectedIdentity]identityNotRequired[Dict[str, Any]]dialect_optionsNrrLrMrNrrmsj I EN8 3$$ ('-, -, 10rMrc(eZdZUdZded< ded<y)ReflectedConstraintzDictionary representing the reflected elements corresponding to :class:`.Constraint` A base class for all constraints rrrrNrrLrMrNrrs  ''0rMrc(eZdZUdZded< ded<y)ReflectedCheckConstraintzDictionary representing the reflected elements corresponding to :class:`.CheckConstraint`. The :class:`.ReflectedCheckConstraint` structure is returned by the :meth:`.Inspector.get_check_constraints` method. rarrrNrrLrMrNrrsL/00rMrc4eZdZUdZded< ded< ded<y) ReflectedUniqueConstraintzDictionary representing the reflected elements corresponding to :class:`.UniqueConstraint`. The :class:`.ReflectedUniqueConstraint` structure is returned by the :meth:`.Inspector.get_unique_constraints` method. List[str] column_namesrduplicates_indexrrNrrLrMrNrrs&;00L00rMrc(eZdZUdZded< ded<y)ReflectedPrimaryKeyConstraintzDictionary representing the reflected elements corresponding to :class:`.PrimaryKeyConstraint`. The :class:`.ReflectedPrimaryKeyConstraint` structure is returned by the :meth:`.Inspector.get_pk_constraint` method. rconstrained_columnsrrNrrLrMrNrrs#"500KrMrcLeZdZUdZded< ded< ded< ded< d ed <y ) ReflectedForeignKeyConstraintzDictionary representing the reflected elements corresponding to :class:`.ForeignKeyConstraint`. The :class:`.ReflectedForeignKeyConstraint` structure is returned by the :meth:`.Inspector.get_foreign_keys` method. rrrreferred_schemarareferred_tablereferred_columnsroptionsNrrLrMrNrrs6#";""1*J ((ErMrcpeZdZUdZded< ded< ded< ded < d ed < ded < d ed< ded<y)ReflectedIndexzDictionary representing the reflected elements corresponding to :class:`.Index`. The :class:`.ReflectedIndex` structure is returned by the :meth:`.Inspector.get_indexes` method. rrzList[Optional[str]]rzNotRequired[List[str]] expressionsruniquerduplicates_constraintinclude_columnsz"NotRequired[Dict[str, Tuple[str]]]column_sortingrrNrrLrMrNrrs` %% (' L455A++7610ErMrceZdZUdZded<y)ReflectedTableCommentzDictionary representing the reflected comment corresponding to the :attr:`_schema.Table.comment` attribute. The :class:`.ReflectedTableComment` structure is returned by the :meth:`.Inspector.get_table_comment` method. rtextNrrLrMrNrr9s rMrc eZdZdZdZ dZ dZy) BindTypingzDefine different methods of passing typing information for bound parameters in a statement to the database driver. .. versionadded:: 2.0 r%rrBN)rDrErFrQNONE SETINPUTSIZES RENDER_CASTSrLrMrNrrFs+ DM LrMr.c eZdZUdZej Zej ZejZejZejZ de d<de d< de d< de d<de d < e jdd Z d e d < de d < de d<de d< de d< de d< de d< de d< de d< de d< de d< d e d!< d"e d#< d e d$< d"e d%<d&e d'< d(e d)< d e d*< d+e d,< d-e d.< d-e d/< d0e d1< d e d2< d e d3< d e d4< d e d5< d e d6< d e d7< d8Zde d9< d e d:< d e d;< d e d<< d e d=< d e d>< d e d?< d e d@< dAe dB< d+e dC< d+e dD< d e dE< d e dF< d e dG< d e dH< d e dI< d e dJ< d e dK< d e dL< d e dM< dNe dO< d e dP< d e dQ< d+e dR< d e dS< d e dT< d e dU< d e dV< d e dW< dXZdYe dZ< d[Zd\e d]< e j"Zd^e d_< d e d`< d e da< d e db< dcZddZd e de< d e df< ej,Z d e dg< d e dh< die dj< d-e dk< dle dm< dle dn< d e do< d e dp< d e dq< d e dr<dse dt<dduZddvZeddwZddxZddyZerddzZ d dd{Z dXdXd| dd}Z! d dd~Z"dXdXd| ddZ# d ddZ$dXdXd| ddZ% d ddZ& d ddZ' d ddZ( d ddZ) d ddZ* d ddZ+ddZ, d ddZ- d ddZ.dXdXd| ddZ/ d ddZ0dXdXd| ddZ1 d ddZ2dXdXd| ddZ3 d ddZ4dXdXd| ddZ5 d ddZ6dXdXd| ddZ7ddZ8ddZ9 d ddZ: d ddZ; d ddZ< ddZ=ddZ>ddZ?ddZ@ddZAddZBddZCddZDddZEddZF ddZGddZHddZI ddZJddZKddZLddZM d ddZN d ddZOddZP ddZQ d ddZR d ddZS d ddZT ddZUddZVddZWddZXddZY ddZZ ddZ[ddZ\ ddZ] ddZ^ ddZ_eddZ`eddZaeddZbeddZcddZd ddZe dd„ZfddÄZgddĄZhyX(DialectaeDefine 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. zdispatcher[Dialect]dispatchrardriverdialect_descriptionzOptional[DBAPIModule]dbapict)zsame as .dbapi, but is never None; will raise an error if no DBAPI was set up. .. versionadded:: 2.0 NotImplementedErrorrts rN loaded_dbapizDialect.loaded_dbapi "##rMr positional paramstyler3compiler_lintingzType[SQLCompiler]statement_compilerzType[DDLCompiler] ddl_compilerzClassVar[Type[TypeCompiler]]type_compiler_clsrtype_compiler_instancer type_compilerzType[IdentifierPreparer]preparerr1identifier_preparerzOptional[Tuple[Any, ...]]server_version_infordefault_schema_namezOptional[IsolationLevel]default_isolation_levelskip_autocommit_rollback_on_connect_isolation_levelzType[ExecutionContext]execution_ctx_clsz4Union[Type[Tuple[Any, ...]], Type[Tuple[List[Any]]]]execute_sequence_formatsupports_alterrmax_identifier_lengthrmax_index_name_lengthmax_constraint_name_lengthz(Union[generic_fn_descriptor[bool], bool]supports_server_side_cursorsserver_side_cursorssupports_sane_rowcountsupports_sane_multi_rowcountsupports_empty_insertsupports_default_valuessupports_default_metavalueDEFAULTdefault_metavalue_tokensupports_multivalues_insertinsert_executemany_returning4insert_executemany_returning_sort_by_parameter_orderupdate_executemany_returningdelete_executemany_returninguse_insertmanyvalues!use_insertmanyvalues_wo_returningr2"insertmanyvalues_implicit_sentinelrinsertmanyvalues_max_parameters"preexecute_autoincrement_sequencesinsert_returningupdate_returningupdate_returning_multifromdelete_returningdelete_returning_multifromfavor_returning_over_lastrowidsupports_identity_columnscte_follows_insertz"##rMct)aImport the DBAPI module that is used by this dialect. The Python module object returned here will be assigned as an instance variable to a constructed dialect under the name ``.dbapi``. .. versionchanged:: 2.0 The :meth:`.Dialect.import_dbapi` class method is renamed from the previous method ``.Dialect.dbapi()``, which would be replaced at dialect instantiation time by the DBAPI module itself, thus using the same name in two different ways. If a ``.Dialect.dbapi()`` classmethod is present on a third-party dialect, it will be used and a deprecation warning will be emitted. rclss rN import_dbapizDialect.import_dbapi "##rMct)a4Transform 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. r)r\typeobjs rNtype_descriptorzDialect.type_descriptor "##rMcy)aCalled 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(). .. note:: as of SQLAlchemy 1.4, this method is called **before** any :meth:`_engine.Dialect.on_connect` hooks are called. NrLr\ connections rN initializezDialect.initializer_rMcyrZrL)r\ method_names rN_overrides_defaultzDialect._overrides_default(r_rMc t)aReturn 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 corresponding to the :class:`.ReflectedColumn` dictionary. This is an internal dialect method. Applications should use :meth:`.Inspector.get_columns`. rr\rv table_nameschemakws rN get_columnszDialect.get_columns* &"##rM)r~ filter_namesc t)aReturn information about columns in all tables in the given ``schema``. This is an internal dialect method. Applications should use :meth:`.Inspector.get_multi_columns`. .. note:: The :class:`_engine.DefaultDialect` provides a default implementation that will call the single table method for each object returned by :meth:`Dialect.get_table_names`, :meth:`Dialect.get_view_names` or :meth:`Dialect.get_materialized_view_names` depending on the provided ``kind``. Dialects that want to support a faster implementation should implement this method. .. versionadded:: 2.0 rr\rvr~rrs rNget_multi_columnszDialect.get_multi_columns? 4"##rMc t)aReturn 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 corresponding to the :class:`.ReflectedPrimaryKeyConstraint` dictionary. This is an internal dialect method. Applications should use :meth:`.Inspector.get_pk_constraint`. rr|s rNget_pk_constraintzDialect.get_pk_constraint[rrMc t)aReturn information about primary key constraints in all tables in the given ``schema``. This is an internal dialect method. Applications should use :meth:`.Inspector.get_multi_pk_constraint`. .. note:: The :class:`_engine.DefaultDialect` provides a default implementation that will call the single table method for each object returned by :meth:`Dialect.get_table_names`, :meth:`Dialect.get_view_names` or :meth:`Dialect.get_materialized_view_names` depending on the provided ``kind``. Dialects that want to support a faster implementation should implement this method. .. versionadded:: 2.0 rrs rNget_multi_pk_constraintzDialect.get_multi_pk_constraintp 2"##rMc t)aReturn 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 corresponding to the :class:`.ReflectedForeignKeyConstraint` dictionary. This is an internal dialect method. Applications should use :meth:`_engine.Inspector.get_foreign_keys`. rr|s rNget_foreign_keyszDialect.get_foreign_keys $"##rMc t)aReturn information about foreign_keys in all tables in the given ``schema``. This is an internal dialect method. Applications should use :meth:`_engine.Inspector.get_multi_foreign_keys`. .. note:: The :class:`_engine.DefaultDialect` provides a default implementation that will call the single table method for each object returned by :meth:`Dialect.get_table_names`, :meth:`Dialect.get_view_names` or :meth:`Dialect.get_materialized_view_names` depending on the provided ``kind``. Dialects that want to support a faster implementation should implement this method. .. versionadded:: 2.0 rrs rNget_multi_foreign_keyszDialect.get_multi_foreign_keysrrMc t)zReturn a list of table names for ``schema``. This is an internal dialect method. Applications should use :meth:`_engine.Inspector.get_table_names`. rr\rvr~rs rNget_table_nameszDialect.get_table_names "##rMc t)zReturn a list of temporary table names on the given connection, if supported by the underlying backend. This is an internal dialect method. Applications should use :meth:`_engine.Inspector.get_temp_table_names`. rrs rNget_temp_table_nameszDialect.get_temp_table_names "##rMc t)aReturn a list of all non-materialized view names available in the database. This is an internal dialect method. Applications should use :meth:`_engine.Inspector.get_view_names`. :param schema: schema name to query, if not the default schema. rrs rNget_view_nameszDialect.get_view_names "##rMc t)aFReturn a list of all materialized view names available in the database. This is an internal dialect method. Applications should use :meth:`_engine.Inspector.get_materialized_view_names`. :param schema: schema name to query, if not the default schema. .. versionadded:: 2.0 rrs rNget_materialized_view_namesz#Dialect.get_materialized_view_names "##rMc t)a*Return a list of all sequence names available in the database. This is an internal dialect method. Applications should use :meth:`_engine.Inspector.get_sequence_names`. :param schema: schema name to query, if not the default schema. .. versionadded:: 1.4 rrs rNget_sequence_nameszDialect.get_sequence_namesrrMc t)zReturn a list of temporary view names on the given connection, if supported by the underlying backend. This is an internal dialect method. Applications should use :meth:`_engine.Inspector.get_temp_view_names`. rrs rNget_temp_view_nameszDialect.get_temp_view_namesrrMc t)zReturn a list of all schema names available in the database. This is an internal dialect method. Applications should use :meth:`_engine.Inspector.get_schema_names`. r)r\rvrs rNget_schema_nameszDialect.get_schema_names "##rMc t)aGReturn plain or materialized view definition. This is an internal dialect method. Applications should use :meth:`_engine.Inspector.get_view_definition`. Given a :class:`_engine.Connection`, a string ``view_name``, and an optional string ``schema``, return the view definition. r)r\rv view_namer~rs rNget_view_definitionzDialect.get_view_definition ""##rMc t)aReturn 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 corresponding to the :class:`.ReflectedIndex` dictionary. This is an internal dialect method. Applications should use :meth:`.Inspector.get_indexes`. rr|s rN get_indexeszDialect.get_indexes+rrMc t)aReturn information about indexes in in all tables in the given ``schema``. This is an internal dialect method. Applications should use :meth:`.Inspector.get_multi_indexes`. .. note:: The :class:`_engine.DefaultDialect` provides a default implementation that will call the single table method for each object returned by :meth:`Dialect.get_table_names`, :meth:`Dialect.get_view_names` or :meth:`Dialect.get_materialized_view_names` depending on the provided ``kind``. Dialects that want to support a faster implementation should implement this method. .. versionadded:: 2.0 rrs rNget_multi_indexeszDialect.get_multi_indexes?rrMc t)aReturn 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 corresponding to the :class:`.ReflectedUniqueConstraint` dictionary. This is an internal dialect method. Applications should use :meth:`.Inspector.get_unique_constraints`. rr|s rNget_unique_constraintszDialect.get_unique_constraints[rrMc t)aReturn information about unique constraints in all tables in the given ``schema``. This is an internal dialect method. Applications should use :meth:`.Inspector.get_multi_unique_constraints`. .. note:: The :class:`_engine.DefaultDialect` provides a default implementation that will call the single table method for each object returned by :meth:`Dialect.get_table_names`, :meth:`Dialect.get_view_names` or :meth:`Dialect.get_materialized_view_names` depending on the provided ``kind``. Dialects that want to support a faster implementation should implement this method. .. versionadded:: 2.0 rrs rNget_multi_unique_constraintsz$Dialect.get_multi_unique_constraintsnrrMc t)aReturn 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 corresponding to the :class:`.ReflectedCheckConstraint` dictionary. This is an internal dialect method. Applications should use :meth:`.Inspector.get_check_constraints`. rr|s rNget_check_constraintszDialect.get_check_constraintsrrMc t)aReturn information about check constraints in all tables in the given ``schema``. This is an internal dialect method. Applications should use :meth:`.Inspector.get_multi_check_constraints`. .. note:: The :class:`_engine.DefaultDialect` provides a default implementation that will call the single table method for each object returned by :meth:`Dialect.get_table_names`, :meth:`Dialect.get_view_names` or :meth:`Dialect.get_materialized_view_names` depending on the provided ``kind``. Dialects that want to support a faster implementation should implement this method. .. versionadded:: 2.0 rrs rNget_multi_check_constraintsz#Dialect.get_multi_check_constraintsrrMc t)zReturn a dictionary of options specified when ``table_name`` was created. This is an internal dialect method. Applications should use :meth:`_engine.Inspector.get_table_options`. rr|s rNget_table_optionszDialect.get_table_optionsrrMc t)aReturn a dictionary of options specified when the tables in the given schema were created. This is an internal dialect method. Applications should use :meth:`_engine.Inspector.get_multi_table_options`. .. note:: The :class:`_engine.DefaultDialect` provides a default implementation that will call the single table method for each object returned by :meth:`Dialect.get_table_names`, :meth:`Dialect.get_view_names` or :meth:`Dialect.get_materialized_view_names` depending on the provided ``kind``. Dialects that want to support a faster implementation should implement this method. .. versionadded:: 2.0 rrs rNget_multi_table_optionszDialect.get_multi_table_optionsrrMc t)aReturn 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 corresponding to the :class:`.ReflectedTableComment` dictionary. This is an internal dialect method. Applications should use :meth:`.Inspector.get_table_comment`. :raise: ``NotImplementedError`` for dialects that don't support comments. .. versionadded:: 1.2 rr|s rNget_table_commentzDialect.get_table_comments ."##rMc t)aReturn information about the table comment in all tables in the given ``schema``. This is an internal dialect method. Applications should use :meth:`_engine.Inspector.get_multi_table_comment`. .. note:: The :class:`_engine.DefaultDialect` provides a default implementation that will call the single table method for each object returned by :meth:`Dialect.get_table_names`, :meth:`Dialect.get_view_names` or :meth:`Dialect.get_materialized_view_names` depending on the provided ``kind``. Dialects that want to support a faster implementation should implement this method. .. versionadded:: 2.0 rrs rNget_multi_table_commentzDialect.get_multi_table_commentrrMct)zconvert 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. rr\rs rNnormalize_namezDialect.normalize_namerrMct)zconvert 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. rrs rNdenormalize_namezDialect.denormalize_name#rrMc t)aFor internal dialect use, check the existence of a particular table or view in the database. Given a :class:`_engine.Connection` object, a string table_name and optional schema name, return True if the given table exists in the database, False otherwise. This method serves as the underlying implementation of the public facing :meth:`.Inspector.has_table` method, and is also used internally to implement the "checkfirst" behavior for methods like :meth:`_schema.Table.create` and :meth:`_schema.MetaData.create_all`. .. note:: This method is used internally by SQLAlchemy, and is published so that third-party dialects may provide an implementation. It is **not** the public API for checking for table presence. Please use the :meth:`.Inspector.has_table` method. .. versionchanged:: 2.0:: :meth:`_engine.Dialect.has_table` now formally supports checking for additional table-like objects: * any type of views (plain or materialized) * temporary tables of any kind Previously, these two checks were not formally specified and different dialects would vary in their behavior. The dialect testing suite now includes tests for all of these object types, and dialects to the degree that the backing database supports views or temporary tables should seek to support locating these objects for full compliance. rr|s rN has_tablezDialect.has_table-sN"##rMc t)aCheck the existence of a particular index name in the database. Given a :class:`_engine.Connection` object, a string ``table_name`` and string index name, return ``True`` if an index of the given name on the given table exists, ``False`` otherwise. The :class:`.DefaultDialect` implements this in terms of the :meth:`.Dialect.has_table` and :meth:`.Dialect.get_indexes` methods, however dialects can implement a more performant version. This is an internal dialect method. Applications should use :meth:`_engine.Inspector.has_index`. .. versionadded:: 1.4 r)r\rvr} index_namer~rs rN has_indexzDialect.has_indexVrrMc t)apCheck the existence of a particular sequence in the database. Given a :class:`_engine.Connection` object and a string `sequence_name`, return ``True`` if the given sequence exists in the database, ``False`` otherwise. This is an internal dialect method. Applications should use :meth:`_engine.Inspector.has_sequence`. r)r\rv sequence_namer~rs rN has_sequencezDialect.has_sequenceqrrMc t)avCheck the existence of a particular schema name in the database. Given a :class:`_engine.Connection` object, a string ``schema_name``, return ``True`` if a schema of the given exists, ``False`` otherwise. The :class:`.DefaultDialect` implements this by checking the presence of ``schema_name`` among the schemas returned by :meth:`.Dialect.get_schema_names`, however dialects can implement a more performant version. This is an internal dialect method. Applications should use :meth:`_engine.Inspector.has_schema`. .. versionadded:: 2.0 r)r\rv schema_namers rN has_schemazDialect.has_schemas *"##rMct)zRetrieve the server version info from the given connection. This is used by the default implementation to populate the "server_version_info" attribute and is called exactly once upon first connect. rrus rN_get_server_version_infoz Dialect._get_server_version_info "##rMct)aReturn the string name of the currently selected schema from the given connection. This is used by the default implementation to populate the "default_schema_name" attribute and is called exactly once upon first connect. rrus rN_get_default_schema_namez Dialect._get_default_schema_namerrMct)aProvide an implementation of ``connection.begin()``, given a DB-API connection. The DBAPI has no dedicated "begin" method and it is expected that transactions are implicit. This hook is provided for those DBAPIs that might need additional help in this area. :param dbapi_connection: a DBAPI connection, typically proxied within a :class:`.ConnectionFairy`. rr\dbapi_connections rNdo_beginzDialect.do_beginrrMct)zProvide an implementation of ``connection.rollback()``, given a DB-API connection. :param dbapi_connection: a DBAPI connection, typically proxied within a :class:`.ConnectionFairy`. rrs rN do_rollbackzDialect.do_rollbackrrMct)zProvide an implementation of ``connection.commit()``, given a DB-API connection. :param dbapi_connection: a DBAPI connection, typically proxied within a :class:`.ConnectionFairy`. rrs rN do_commitzDialect.do_commitrrMct)aProvide an implementation of ``connection.close()`` that tries as much as possible to not block, given a DBAPI connection. In the vast majority of cases this just calls .close(), however for some asyncio dialects may call upon different API features. This hook is called by the :class:`_pool.Pool` when a connection is being recycled or has been invalidated. .. versionadded:: 1.4.41 rrs rN do_terminatezDialect.do_terminaterrMct)a Provide an implementation of ``connection.close()``, given a DBAPI connection. This hook is called by the :class:`_pool.Pool` when a connection has been detached from the pool, or is being returned beyond the normal capacity of the pool. rrs rNdo_closezDialect.do_closerrMctrZrrs rN_do_ping_w_eventzDialect._do_ping_w_eventrfrMct)zNping the DBAPI connection and return True if the connection is usable.rrs rNdo_pingzDialect.do_ping "##rMct)aJinvoke the cursor.setinputsizes() method with appropriate arguments This hook is called if the :attr:`.Dialect.bind_typing` attribute is set to the :attr:`.BindTyping.SETINPUTSIZES` value. Parameter data is passed in a list of tuples (paramname, dbtype, sqltype), where ``paramname`` is the key of the parameter in the statement, ``dbtype`` is the DBAPI datatype and ``sqltype`` is the SQLAlchemy type. The order of tuples is in the correct parameter order. .. versionadded:: 1.4 .. versionchanged:: 2.0 - setinputsizes mode is now enabled by setting :attr:`.Dialect.bind_typing` to :attr:`.BindTyping.SETINPUTSIZES`. Dialects which accept a ``use_setinputsizes`` parameter should set this value appropriately. r)r\r{list_of_tuplescontexts rNdo_set_input_sizeszDialect.do_set_input_sizesrrMct)zCreate a two-phase transaction ID. This id will be passed to do_begin_twophase(), do_rollback_twophase(), do_commit_twophase(). Its format is unspecified. rrts rN create_xidzDialect.create_xidrrMct)zCreate a savepoint with the given name. :param connection: a :class:`_engine.Connection`. :param name: savepoint name. rr\rvrs rN do_savepointzDialect.do_savepoint#rrMct)zRollback a connection to the named savepoint. :param connection: a :class:`_engine.Connection`. :param name: savepoint name. rrs rNdo_rollback_to_savepointz Dialect.do_rollback_to_savepoint-rrMct)zRelease the named savepoint on a connection. :param connection: a :class:`_engine.Connection`. :param name: savepoint name. rrs rNdo_release_savepointzDialect.do_release_savepoint9s "##rMct)zBegin a two phase transaction on the given connection. :param connection: a :class:`_engine.Connection`. :param xid: xid rr\rvxids rNdo_begin_twophasezDialect.do_begin_twophaseBrrMct)zPrepare a two phase transaction on the given connection. :param connection: a :class:`_engine.Connection`. :param xid: xid rrs rNdo_prepare_twophasezDialect.do_prepare_twophaseLrrMct)a3Rollback a two phase transaction on the given connection. :param connection: a :class:`_engine.Connection`. :param xid: xid :param is_prepared: whether or not :meth:`.TwoPhaseTransaction.prepare` was called. :param recover: if the recover flag was passed. rr\rvr is_preparedrecovers rNdo_rollback_twophasezDialect.do_rollback_twophaseVrrMct)a2Commit a two phase transaction on the given connection. :param connection: a :class:`_engine.Connection`. :param xid: xid :param is_prepared: whether or not :meth:`.TwoPhaseTransaction.prepare` was called. :param recover: if the recover flag was passed. rrs rNdo_commit_twophasezDialect.do_commit_twophaseirrMct)zRecover list of uncommitted prepared two phase transaction identifiers on the given connection. :param connection: a :class:`_engine.Connection`. rrus rNdo_recover_twophasezDialect.do_recover_twophase}rrMct)zconvert executemany parameters for an INSERT into an iterator of statement/single execute values, used by the insertmanyvalues feature. r)r\rvr{ statementrgeneric_setinputsizesrs rN!_deliver_insertmanyvalues_batchesz)Dialect._deliver_insertmanyvalues_batchess "##rMct)zSProvide an implementation of ``cursor.executemany(statement, parameters)``.rr\r{rrrs rNdo_executemanyzDialect.do_executemanyrrMct)zOProvide an implementation of ``cursor.execute(statement, parameters)``.rrs rN do_executezDialect.do_executerrMct)z{Provide an implementation of ``cursor.execute(statement)``. The parameter collection should not be sent. r)r\r{rrs rNdo_execute_no_paramszDialect.do_execute_no_paramsrsrMct)zMReturn True if the given DB-API error indicates an invalid connectionr)r\ervr{s rN is_disconnectzDialect.is_disconnectrrMct)aEstablish a connection using this dialect's DBAPI. The default implementation of this method is:: def connect(self, *cargs, **cparams): return self.dbapi.connect(*cargs, **cparams) The ``*cargs, **cparams`` parameters are generated directly from this dialect's :meth:`.Dialect.create_connect_args` method. This method may be used for dialects that need to perform programmatic per-connection steps when a new connection is procured from the DBAPI. :param \*cargs: positional parameters returned from the :meth:`.Dialect.create_connect_args` method :param \*\*cparams: keyword parameters returned from the :meth:`.Dialect.create_connect_args` method. :return: a DBAPI connection, typically from the :pep:`249` module level ``.connect()`` function. .. seealso:: :meth:`.Dialect.create_connect_args` :meth:`.Dialect.on_connect` r)r\cargscparamss rNconnectzDialect.connect@"##rMc"|jS)a& return a callable which sets up a newly created DBAPI connection. This method is a new hook that supersedes the :meth:`_engine.Dialect.on_connect` method when implemented by a dialect. When not implemented by a dialect, it invokes the :meth:`_engine.Dialect.on_connect` method directly to maintain compatibility with existing dialects. There is no deprecation for :meth:`_engine.Dialect.on_connect` expected. The callable should accept a single argument "conn" which is the DBAPI connection itself. The inner callable has no return value. E.g.:: class MyDialect(default.DefaultDialect): # ... def on_connect_url(self, url): def do_on_connect(connection): connection.execute("SET SPECIAL FLAGS etc") return do_on_connect This is used to set dialect-wide per-connection options such as isolation modes, Unicode modes, etc. This method differs from :meth:`_engine.Dialect.on_connect` in that it is passed the :class:`_engine.URL` object that's relevant to the connect args. Normally the only way to get this is from the :meth:`_engine.Dialect.on_connect` hook is to look on the :class:`_engine.Engine` itself, however this URL object may have been replaced by plugins. .. note:: The default implementation of :meth:`_engine.Dialect.on_connect_url` is to invoke the :meth:`_engine.Dialect.on_connect` method. Therefore if a dialect implements this method, the :meth:`_engine.Dialect.on_connect` method **will not be called** unless the overriding dialect calls it directly from here. .. versionadded:: 1.4.3 added :meth:`_engine.Dialect.on_connect_url` which normally calls into :meth:`_engine.Dialect.on_connect`. :param url: a :class:`_engine.URL` object representing the :class:`_engine.URL` that was passed to the :meth:`_engine.Dialect.create_connect_args` method. :return: a callable that accepts a single DBAPI connection as an argument, or None. .. seealso:: :meth:`_engine.Dialect.on_connect` ) on_connectrhs rNon_connect_urlzDialect.on_connect_urlsv  rMcy)areturn a callable which sets up a newly created DBAPI connection. The callable should accept a single argument "conn" which is the DBAPI connection itself. The inner callable has no return value. E.g.:: class MyDialect(default.DefaultDialect): # ... def on_connect(self): def do_on_connect(connection): connection.execute("SET SPECIAL FLAGS etc") return do_on_connect This is used to set dialect-wide per-connection options such as isolation modes, Unicode modes, etc. The "do_on_connect" callable is invoked by using the :meth:`_events.PoolEvents.connect` event hook, then unwrapping the DBAPI connection and passing it into the callable. .. versionchanged:: 1.4 the on_connect hook is no longer called twice for the first connection of a dialect. The on_connect hook is still called before the :meth:`_engine.Dialect.initialize` method however. .. versionchanged:: 1.4.3 the on_connect hook is invoked from a new method on_connect_url that passes the URL that was used to create the connect args. Dialects can implement on_connect_url instead of on_connect if they need the URL object that was used for the connection in order to get additional context. If None is returned, no event listener is generated. :return: a callable that accepts a single DBAPI connection as an argument, or None. .. seealso:: :meth:`.Dialect.connect` - allows the DBAPI ``connect()`` sequence itself to be controlled. :meth:`.Dialect.on_connect_url` - supersedes :meth:`.Dialect.on_connect` to also receive the :class:`_engine.URL` object in context. NrLrts rNrzDialect.on_connect' sfrMct)a2Given a DBAPI connection, revert its isolation to the default. Note that this is a dialect-level method which is used as part of the implementation of the :class:`_engine.Connection` and :class:`_engine.Engine` isolation level facilities; these APIs should be preferred for most typical use cases. .. seealso:: :meth:`_engine.Connection.get_isolation_level` - view current level :attr:`_engine.Connection.default_isolation_level` - view default level :paramref:`.Connection.execution_options.isolation_level` - set per :class:`_engine.Connection` isolation level :paramref:`_sa.create_engine.isolation_level` - set per :class:`_engine.Engine` isolation level rrs rNreset_isolation_levelzDialect.reset_isolation_level\ rrMct)a2Given a DBAPI connection, set its isolation level. Note that this is a dialect-level method which is used as part of the implementation of the :class:`_engine.Connection` and :class:`_engine.Engine` isolation level facilities; these APIs should be preferred for most typical use cases. If the dialect also implements the :meth:`.Dialect.get_isolation_level_values` method, then the given level is guaranteed to be one of the string names within that sequence, and the method will not need to anticipate a lookup failure. .. seealso:: :meth:`_engine.Connection.get_isolation_level` - view current level :attr:`_engine.Connection.default_isolation_level` - view default level :paramref:`.Connection.execution_options.isolation_level` - set per :class:`_engine.Connection` isolation level :paramref:`_sa.create_engine.isolation_level` - set per :class:`_engine.Engine` isolation level r)r\rlevels rNset_isolation_levelzDialect.set_isolation_levelw rrMct)aGiven a DBAPI connection, return its isolation level. When working with a :class:`_engine.Connection` object, the corresponding DBAPI connection may be procured using the :attr:`_engine.Connection.connection` accessor. Note that this is a dialect-level method which is used as part of the implementation of the :class:`_engine.Connection` and :class:`_engine.Engine` isolation level facilities; these APIs should be preferred for most typical use cases. .. seealso:: :meth:`_engine.Connection.get_isolation_level` - view current level :attr:`_engine.Connection.default_isolation_level` - view default level :paramref:`.Connection.execution_options.isolation_level` - set per :class:`_engine.Connection` isolation level :paramref:`_sa.create_engine.isolation_level` - set per :class:`_engine.Engine` isolation level rrs rNget_isolation_levelzDialect.get_isolation_level sB"##rMctd)aDetect the current autocommit setting for a DBAPI connection. :param dbapi_connection: a DBAPI connection object :return: True if autocommit is enabled, False if disabled :rtype: bool This method inspects the given DBAPI connection to determine whether autocommit mode is currently enabled. The specific mechanism for detecting autocommit varies by database dialect and DBAPI driver, however it should be done **without** network round trips. .. note:: Not all dialects support autocommit detection. Dialects that do not support this feature will raise :exc:`NotImplementedError`. z;This dialect cannot detect autocommit on a DBAPI connectionrr\ dbapi_conns rNdetect_autocommit_settingz!Dialect.detect_autocommit_setting s(" I  rMct)aGiven a DBAPI connection, return its isolation level, or a default isolation level if one cannot be retrieved. This method may only raise NotImplementedError and **must not raise any other exception**, as it is used implicitly upon first connect. The method **must return a value** for a dialect that supports isolation level settings, as this level is what will be reverted towards when a per-connection isolation level change is made. The method defaults to using the :meth:`.Dialect.get_isolation_level` method unless overridden by a dialect. .. versionadded:: 1.3.22 rrs rNget_default_isolation_levelz#Dialect.get_default_isolation_level s ("##rMct)areturn a sequence of string isolation level names that are accepted by this dialect. The available names should use the following conventions: * use UPPERCASE names. isolation level methods will accept lowercase names but these are normalized into UPPERCASE before being passed along to the dialect. * separate words should be separated by spaces, not underscores, e.g. ``REPEATABLE READ``. isolation level names will have underscores converted to spaces before being passed along to the dialect. * The names for the four standard isolation names to the extent that they are supported by the backend should be ``READ UNCOMMITTED``, ``READ COMMITTED``, ``REPEATABLE READ``, ``SERIALIZABLE`` * if the dialect supports an autocommit option it should be provided using the isolation level name ``AUTOCOMMIT``. * Other isolation modes may also be present, provided that they are named in UPPERCASE and use spaces not underscores. This function is used so that the default dialect can check that a given isolation level parameter is valid, else raises an :class:`_exc.ArgumentError`. A DBAPI connection is passed to the method, in the unlikely event that the dialect needs to interrogate the connection itself to determine this list, however it is expected that most backends will return a hardcoded list of values. If the dialect supports "AUTOCOMMIT", that value should also be present in the sequence returned. The method raises ``NotImplementedError`` by default. If a dialect does not implement this method, then the default dialect will not perform any checking on a given isolation level value before passing it onto the :meth:`.Dialect.set_isolation_level` method. This is to allow backwards-compatibility with third party dialects that may not yet be implementing this method. .. versionadded:: 2.0 rrs rNget_isolation_level_valuesz"Dialect.get_isolation_level_values sT"##rMctrZr)r\rrs rN_assert_and_set_isolation_levelz'Dialect._assert_and_set_isolation_level rrMc|S)a}Given a URL, return the :class:`.Dialect` that will be used. This is a hook that allows an external plugin to provide functionality around an existing dialect, by allowing the plugin to be loaded from the url based on an entrypoint, and then the plugin returns the actual dialect to be used. By default this just returns the cls. rLrmris rNget_dialect_clszDialect.get_dialect_cls s  rMc$|j|S)aGiven a URL, return the :class:`.Dialect` that will be used by an async engine. By default this is an alias of :meth:`.Dialect.get_dialect_cls` and just returns the cls. It may be used if a dialect provides both a sync and async version under the same name, like the ``psycopg`` driver. .. versionadded:: 2 .. seealso:: :meth:`.Dialect.get_dialect_cls` )r)r(s rNget_async_dialect_clszDialect.get_async_dialect_cls) s"""3''rMcy)aJset up the provision.py module for this dialect. For dialects that include a provision.py module that sets up provisioning followers, this method should initiate that process. A typical implementation would be:: @classmethod def load_provisioning(cls): __import__("mydialect.provision") The default method assumes a module named ``provision.py`` inside the owning package of the current dialect, based on the ``__module__`` attribute:: @classmethod def load_provisioning(cls): package = ".".join(cls.__module__.split(".")[0:-1]) try: __import__(package + ".provision") except ImportError: pass .. versionadded:: 1.3.14 NrLrls rNload_provisioningzDialect.load_provisioning< r_rMcy)a_A convenience hook called before returning the final :class:`_engine.Engine`. If the dialect returned a different class from the :meth:`.get_dialect_cls` method, then the hook is called on both classes, first on the dialect class returned by the :meth:`.get_dialect_cls` method and then on the class on which the method was called. The hook should be used by dialects and/or wrappers to apply special events to the engine or its components. In particular, it allows a dialect-wrapping class to apply dialect-level events. NrL)rmengines rNengine_createdzDialect.engine_createdY r_rMct)aReturns the connection object as returned by the external driver package. For normal dialects that use a DBAPI compliant driver this call will just return the ``connection`` passed as argument. For dialects that instead adapt a non DBAPI compliant driver, like when adapting an asyncio driver, this call will return the connection-like object as returned by the driver. .. versionadded:: 1.4.24 rrus rNget_driver_connectionzDialect.get_driver_connectionj rrMct)aaEstablish execution options for a given engine. This is implemented by :class:`.DefaultDialect` to establish event hooks for new :class:`.Connection` instances created by the given :class:`.Engine` which will then invoke the :meth:`.Dialect.set_connection_execution_options` method for that connection. r)r\r/optss rNset_engine_execution_optionsz$Dialect.set_engine_execution_optionsy rsrMct)aEstablish execution options for a given connection. This is implemented by :class:`.DefaultDialect` in order to implement the :paramref:`_engine.Connection.execution_options.isolation_level` execution option. Dialects can intercept various execution options which may need to modify state on a particular DBAPI connection. .. versionadded:: 1.4 r)r\rvr4s rN set_connection_execution_optionsz(Dialect.set_connection_execution_options rrMct)z*return a Pool class to use for a given URLrrhs rNget_dialect_pool_classzDialect.get_dialect_pool_class s !##rMcy)z=Validates an identifier name, raising an exception if invalidNrL)r\idents rNvalidate_identifierzDialect.validate_identifier r_rM)rbrV)rbzOptional[_ListenerFnType])rir)rbConnectArgsType)rqTypeEngine[_T]rbr>)rvr&rbr)ryrarbrrZ) rvr&r}rar~rrrrbzList[ReflectedColumn]) rvr&r~rrOptional[Collection[str]]rrrbz0Iterable[Tuple[TableKey, List[ReflectedColumn]]]) rvr&r}rar~rrrrbr) rvr&r~rrr?rrrbz8Iterable[Tuple[TableKey, ReflectedPrimaryKeyConstraint]]) rvr&r}rar~rrrrbz#List[ReflectedForeignKeyConstraint]) rvr&r~rrr?rrrbz>Iterable[Tuple[TableKey, List[ReflectedForeignKeyConstraint]]])rvr&r~rrrrbr)rvr&rrrbr) rvr&rrar~rrrrbra) rvr&r}rar~rrrrbzList[ReflectedIndex]) rvr&r~rrr?rrrbz/Iterable[Tuple[TableKey, List[ReflectedIndex]]]) rvr&r}rar~rrrrbzList[ReflectedUniqueConstraint]) rvr&r~rrr?rrrbz:Iterable[Tuple[TableKey, List[ReflectedUniqueConstraint]]]) rvr&r}rar~rrrrbzList[ReflectedCheckConstraint]) rvr&r~rrr?rrrbz9Iterable[Tuple[TableKey, List[ReflectedCheckConstraint]]]) rvr&r}rar~rrrrbDict[str, Any]) rvr&r~rrr?rrrbz)Iterable[Tuple[TableKey, Dict[str, Any]]]) rvr&r}rar~rrrrbr) rvr&r~rrr?rrrbz0Iterable[Tuple[TableKey, ReflectedTableComment]])rrarbra) rvr&r}rar~rrrrbr) rvr&r}rarrar~rrrrbr) rvr&rrar~rrrrbr)rvr&rrarrrbr)rvr&rbr)rvr&rbra)rrrbr)rrrrbr)rrrrbr)r{rr_GenericSetInputSizesTyperExecutionContextrbrrbr)rvr&rrarbr)rvr&rrrbr)TF) rvr&rrrrrrrbr)rvr&rbz List[Any])rvr&r{rrrarrrz#Optional[_GenericSetInputSizesType]rrBrbz Iterator[_InsertManyValuesBatch]) r{rrrarrrOptional[ExecutionContext]rbr) r{rrrarrrrDrbr)r{rrrarrDrbr)r rXrvz7Optional[Union[PoolProxiedConnection, DBAPIConnection]]r{Optional[DBAPICursor]rbr)rrrrrbrr)rir)rbzOptional[Callable[[Any], Any]])rbzOptional[Callable[[Any], None]])rrrrrrbr)rrrrbr)rrrrbr)rrrrbr)rrrrbzSequence[IsolationLevel])rrrrrrbr)rir)rb Type[Dialect]rr/r'rbr)rvrrrbr)r/r'r4CoreExecuteOptionsParameterrbr)rvr&r4rHrbr)rir)rb Type[Pool])r;rarbr)irDrErFrQrArGrHrIrJrKrrnon_memoized_propertyrr4rPrR EMPTY_DICTrS _has_eventsrWrr  bind_typingrerj classmethodrnrrrwrrzrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr r rrrrrrr r"r$r&r)r+r-r0r2r5r7r9r<rLrMrNr r s  $$I&&J!22**L#66!! I K2  , $ $@O))C##C33 )('&,+ 32 '&65E""":9--O41((" --"#KJ?! #'&  "!: $$$-S,"&% #'& ;?>#'&>"&&><(,+ )ED !$# &)( )-,  !%$  !%$ %)( $#+&KJ G  "! "!0  <)+ *:>#%6HK1#'& K%)d)" $#://KNB0+*  9//0/%)(=ML##??$$B$$" $ $C !% $$$ $  $  $2!%26 $$ $ 0 $  $ :$@!% $$$ $  $ ' $2!%26 $$ $ 0 $  $ B$>!% $$$ $  $ - $0!%26 $$ $ 0 $  $ H$:?C $$ $.; $JM $  $?C $$ $.; $JM $  $?C $$ $.; $JM $  $ ?C$$$.;$JM$ $$?C $$ $.; $JM $  $ ?C $$ $.; $JM $  $$!% $$$ $  $ $.!% $$$ $  $  $0!%26 $$ $ 0 $  $ 9$@!% $$$ $  $ ) $.!%26 $$ $ 0 $  $ D$@!% $$$ $  $ ( $0!%26 $$ $ 0 $  $ C$@!% $ $ $ $  $  $&!%26 $$ $ 0 $  $ 3$>!% $$$ $  $  $:!%26 $$ $ 0 $  $ :$8$$!% '$'$'$ '$  '$  '$\!% $$$ $  $  $ $>!% $$$ $  $  $&$$$36$>A$ $. $ $ $ $ $$" $$$ $$2$" $ $8$$ $$ $,/ $  $$$$! $$$ $  $  $.! $$$ $  $  $($$$$ $ - $ C $"$ *$*/3 $ $ $- $ , $  $"/3 $ $ $8 $ , $  $ /3 $ $ $, $  $ $  $L $& $  $ $D;!z3j$6 $ / $8F $  $D!$ /!$ !$F 0$)$ $,*$)*$ !*$X$)$2@$ $   (($  8  $ $ $$? $  $ $$ $,G $  $$LrMr cPeZdZdZddZd dZ d dZ d dZd dZy) CreateEnginePluginaA set of hooks intended to augment the construction of an :class:`_engine.Engine` object based on entrypoint names in a URL. The purpose of :class:`_engine.CreateEnginePlugin` is to allow third-party systems to apply engine, pool and dialect level event listeners without the need for the target application to be modified; instead, the plugin names can be added to the database URL. Target applications for :class:`_engine.CreateEnginePlugin` include: * connection and SQL performance tools, e.g. which use events to track number of checkouts and/or time spent with statements * connectivity plugins such as proxies A rudimentary :class:`_engine.CreateEnginePlugin` that attaches a logger to an :class:`_engine.Engine` object might look like:: import logging from sqlalchemy.engine import CreateEnginePlugin from sqlalchemy import event class LogCursorEventsPlugin(CreateEnginePlugin): def __init__(self, url, kwargs): # consume the parameter "log_cursor_logging_name" from the # URL query logging_name = url.query.get( "log_cursor_logging_name", "log_cursor" ) self.log = logging.getLogger(logging_name) def update_url(self, url): "update the URL to one that no longer includes our parameters" return url.difference_update_query(["log_cursor_logging_name"]) def engine_created(self, engine): "attach an event listener after the new Engine is constructed" event.listen(engine, "before_cursor_execute", self._log_event) def _log_event( self, conn, cursor, statement, parameters, context, executemany, ): self.log.info("Plugin logged cursor event: %s", statement) Plugins are registered using entry points in a similar way as that of dialects:: entry_points = { "sqlalchemy.plugins": [ "log_cursor_plugin = myapp.plugins:LogCursorEventsPlugin" ] } A plugin that uses the above names would be invoked from a database URL as in:: from sqlalchemy import create_engine engine = create_engine( "mysql+pymysql://scott:tiger@localhost/test?" "plugin=log_cursor_plugin&log_cursor_logging_name=mylogger" ) The ``plugin`` URL parameter supports multiple instances, so that a URL may specify multiple plugins; they are loaded in the order stated in the URL:: engine = create_engine( "mysql+pymysql://scott:tiger@localhost/test?" "plugin=plugin_one&plugin=plugin_twp&plugin=plugin_three" ) The plugin names may also be passed directly to :func:`_sa.create_engine` using the :paramref:`_sa.create_engine.plugins` argument:: engine = create_engine( "mysql+pymysql://scott:tiger@localhost/test", plugins=["myplugin"] ) .. versionadded:: 1.2.3 plugin names can also be specified to :func:`_sa.create_engine` as a list A plugin may consume plugin-specific arguments from the :class:`_engine.URL` object as well as the ``kwargs`` dictionary, which is the dictionary of arguments passed to the :func:`_sa.create_engine` call. "Consuming" these arguments includes that they must be removed when the plugin initializes, so that the arguments are not passed along to the :class:`_engine.Dialect` constructor, where they will raise an :class:`_exc.ArgumentError` because they are not known by the dialect. As of version 1.4 of SQLAlchemy, arguments should continue to be consumed from the ``kwargs`` dictionary directly, by removing the values with a method such as ``dict.pop``. Arguments from the :class:`_engine.URL` object should be consumed by implementing the :meth:`_engine.CreateEnginePlugin.update_url` method, returning a new copy of the :class:`_engine.URL` with plugin-specific parameters removed:: class MyPlugin(CreateEnginePlugin): def __init__(self, url, kwargs): self.my_argument_one = url.query["my_argument_one"] self.my_argument_two = url.query["my_argument_two"] self.my_argument_three = kwargs.pop("my_argument_three", None) def update_url(self, url): return url.difference_update_query( ["my_argument_one", "my_argument_two"] ) Arguments like those illustrated above would be consumed from a :func:`_sa.create_engine` call such as:: from sqlalchemy import create_engine engine = create_engine( "mysql+pymysql://scott:tiger@localhost/test?" "plugin=myplugin&my_argument_one=foo&my_argument_two=bar", my_argument_three="bat", ) .. versionchanged:: 1.4 The :class:`_engine.URL` object is now immutable; a :class:`_engine.CreateEnginePlugin` that needs to alter the :class:`_engine.URL` should implement the newly added :meth:`_engine.CreateEnginePlugin.update_url` method, which is invoked after the plugin is constructed. For migration, construct the plugin in the following way, checking for the existence of the :meth:`_engine.CreateEnginePlugin.update_url` method to detect which version is running:: class MyPlugin(CreateEnginePlugin): def __init__(self, url, kwargs): if hasattr(CreateEnginePlugin, "update_url"): # detect the 1.4 API self.my_argument_one = url.query["my_argument_one"] self.my_argument_two = url.query["my_argument_two"] else: # detect the 1.3 and earlier API - mutate the # URL directly self.my_argument_one = url.query.pop("my_argument_one") self.my_argument_two = url.query.pop("my_argument_two") self.my_argument_three = kwargs.pop("my_argument_three", None) def update_url(self, url): # this method is only called in the 1.4 version return url.difference_update_query( ["my_argument_one", "my_argument_two"] ) .. seealso:: :ref:`change_5526` - overview of the :class:`_engine.URL` change which also includes notes regarding :class:`_engine.CreateEnginePlugin`. When the engine creation process completes and produces the :class:`_engine.Engine` object, it is again passed to the plugin via the :meth:`_engine.CreateEnginePlugin.engine_created` hook. In this hook, additional changes can be made to the engine, most typically involving setup of events (e.g. those defined in :ref:`core_event_toplevel`). c||_y)aConstruct a new :class:`.CreateEnginePlugin`. The plugin object is instantiated individually for each call to :func:`_sa.create_engine`. A single :class:`_engine. Engine` will be passed to the :meth:`.CreateEnginePlugin.engine_created` method corresponding to this URL. :param url: the :class:`_engine.URL` object. The plugin may inspect the :class:`_engine.URL` for arguments. Arguments used by the plugin should be removed, by returning an updated :class:`_engine.URL` from the :meth:`_engine.CreateEnginePlugin.update_url` method. .. versionchanged:: 1.4 The :class:`_engine.URL` object is now immutable, so a :class:`_engine.CreateEnginePlugin` that needs to alter the :class:`_engine.URL` object should implement the :meth:`_engine.CreateEnginePlugin.update_url` method. :param kwargs: The keyword arguments passed to :func:`_sa.create_engine`. N)ri)r\rirzs rN__init__zCreateEnginePlugin.__init__N s 2rMct)aUpdate the :class:`_engine.URL`. A new :class:`_engine.URL` should be returned. This method is typically used to consume configuration arguments from the :class:`_engine.URL` which must be removed, as they will not be recognized by the dialect. The :meth:`_engine.URL.difference_update_query` method is available to remove these arguments. See the docstring at :class:`_engine.CreateEnginePlugin` for an example. .. versionadded:: 1.4 rrhs rN update_urlzCreateEnginePlugin.update_urli rrMcy)zparse and modify dialect kwargsNrL)r\ dialect_cls dialect_argss rNhandle_dialect_kwargsz(CreateEnginePlugin.handle_dialect_kwargsz r_rMcy)zparse and modify pool kwargsNrL)r\pool_cls pool_argss rNhandle_pool_kwargsz%CreateEnginePlugin.handle_pool_kwargs r_rMcy)zReceive the :class:`_engine.Engine` object when it is fully constructed. The plugin may make additional changes to the engine, such as registering engine or connection pool events. NrL)r\r/s rNr0z!CreateEnginePlugin.engine_created r_rMN)rir)rzr@)rir)rbr))rVrFrWr@rbr)rZrIr[r@rbrrG) rDrErFrQrRrTrXr\r0rLrMrNrPrP sRm^6$".(.8F. . +"+/=+ +  rMrPc0eZdZUdZded< ded< ded< ded< d ed < d ed < d ed< ded< ded< ded< ded< ded< ded< ded< ded< ded< ded< e d1dZeejf d2d Z e d3d!Z e d4d"Z d5d#Z d6d$Z d7d%Zd8d&Zd9d'Zd:d(Zd;d)Z dd-Zd?d.Zd@d/Zy0)ArBzRA messenger object for a Dialect that corresponds to a single execution. r'r/r&rvroot_connectionr dialectrr{zOptional[Compiled]compiledrarzOptional[Executable]invoked_statement_AnyMultiExecuteParamsrrrisinsertisupdaterP execute_stylerz;util.generic_fn_descriptor[Optional[Sequence[Column[Any]]]] prefetch_colspostfetch_cols_ExecuteOptionsexecution_optionsctrZr)rmr`rvrrj compiled_ddls rN _init_ddlzExecutionContext._init_ddl rrMc trZr) rmr`rvrrjrarrbextracted_parameters cache_hits rN_init_compiledzExecutionContext._init_compiled rrMctrZr)rmr`rvrrjrrs rN_init_statementz ExecutionContext._init_statement rrMctrZr)rmr`rvrrjs rN _init_defaultzExecutionContext._init_default rrMctrZr)r\rrtype_s rN _exec_defaultzExecutionContext._exec_default rrMctrZrrts rN_prepare_set_input_sizesz)ExecutionContext._prepare_set_input_sizes" rrMctrZrrts rN_get_cache_statsz!ExecutionContext._get_cache_stats' rfrMctrZrrts rN_setup_result_proxyz$ExecutionContext._setup_result_proxy* rfrMct)zKgiven a :class:`.Sequence`, invoke it and return the next int valuer)r\seqrws rN fire_sequencezExecutionContext.fire_sequence- rrMct)zReturn a new cursor generated from this ExecutionContext's connection. Some dialects may wish to change the behavior of connection.cursor(), such as postgresql which may return a PG "server side" cursor. rrts rN create_cursorzExecutionContext.create_cursor2 rrMct)zCalled before an execution of a compiled statement. If a compiled statement was passed to this ExecutionContext, the `statement` and `parameters` datamembers must be initialized after this statement is complete. rrts rNpre_execzExecutionContext.pre_exec= rrMct)a!Return a sequence of OUT parameter values from a cursor. For dialects that support OUT parameters, this method will be called when there is a :class:`.SQLCompiler` object which has the :attr:`.SQLCompiler.has_out_parameters` flag set. This flag in turn will be set to True if the statement itself has :class:`.BindParameter` objects that have the ``.isoutparam`` flag set which are consumed by the :meth:`.SQLCompiler.visit_bindparam` method. If the dialect compiler produces :class:`.BindParameter` objects with ``.isoutparam`` set which are not handled by :meth:`.SQLCompiler.visit_bindparam`, it should set this flag explicitly. The list of names that were rendered for each bound parameter is passed to the method. The method should then return a sequence of values corresponding to the list of parameter objects. Unlike in previous SQLAlchemy versions, the values can be the **raw values** from the DBAPI; the execution context will apply the appropriate type handler based on what's present in self.compiled.binds and update the values. The processed dictionary will then be made available via the ``.out_parameters`` collection on the result object. Note that SQLAlchemy 1.4 has multiple kinds of result object as part of the 2.0 transition. .. versionadded:: 1.4 - added :meth:`.ExecutionContext.get_out_parameter_values`, which is invoked automatically by the :class:`.DefaultExecutionContext` when there are :class:`.BindParameter` objects with the ``.isoutparam`` flag set. This replaces the practice of setting out parameters within the now-removed ``get_result_proxy()`` method. r)r\out_param_namess rNget_out_parameter_valuesz)ExecutionContext.get_out_parameter_valuesG sD"##rMct)aCalled after the execution of a compiled statement. If a compiled statement was passed to this ExecutionContext, the `last_insert_ids`, `last_inserted_params`, etc. datamembers should be available after this method completes. rrts rN post_execzExecutionContext.post_execk rrMct)zQReceive a DBAPI exception which occurred upon execute, result fetch, etc.r)r\r s rNhandle_dbapi_exceptionz'ExecutionContext.handle_dbapi_exceptionu s "##rMct)zjReturn True if the last INSERT or UPDATE row contained inlined or database-side defaults. rrts rNlastrow_has_defaultsz%ExecutionContext.lastrow_has_defaults{ s "##rMct)zReturn the DBAPI ``cursor.rowcount`` value, or in some cases an interpreted value. See :attr:`_engine.CursorResult.rowcount` for details on this. rrts rN get_rowcountzExecutionContext.get_rowcount rrMct)aFor a RETURNING result, deliver cursor.fetchall() from the DBAPI cursor. This is a dialect-specific hook for dialects that have special considerations when calling upon the rows delivered for a "RETURNING" statement. Default implementation is ``cursor.fetchall()``. This hook is currently used only by the :term:`insertmanyvalues` feature. Dialects that don't set ``use_insertmanyvalues=True`` don't need to consider this hook. .. versionadded:: 2.0.10 r)r\r{s rNfetchall_for_returningz'ExecutionContext.fetchall_for_returning rorMN) r`r rvr&rrrjrirlr0rbrB)r`r rvr&rrrjrirar4r_CoreMultiExecuteParamsrbr.roz&Optional[Sequence[BindParameter[Any]]]rprArbrB)r`r rvr&rrrjrirrarrrbrB) r`r rvr&rrrjrirbrB)rzOptional[Column[Any]]rr8rwzOptional[TypeEngine[Any]]rbr)rbz0Optional[List[Tuple[str, Any, TypeEngine[Any]]]]rbra)rbzCursorResult[Any])rSequence_SchemaItemrwr:rbr)rbrr)rrQrbr)r  BaseExceptionrbr)rbr)rbr)r{rrbr)rDrErFrQrrNrmrArIrqrsrurxrzr|r~rrrrrrrrrrLrMrNrBrB s N8  I 6 4  NC,+'&=N-N-ON9PO'&K$$$0 $ + $ " $ $$!+ ; ; $ $ $0 $ + $  $, $& $E $ $  $ $ $ $ $0 $ + $  $- $  $ $$$$0 $ + $  $$$%$"$) $ $$ 9$ $$$ $$"$,"$ "$H$$ $$$rMrBceZdZUdZded<y)ConnectionEventsTargetzAn object which can accept events from :class:`.ConnectionEvents`. Includes :class:`_engine.Connection` and :class:`_engine.Engine`. .. versionadded:: 2.0 z"dispatcher[ConnectionEventsTarget]rNrrLrMrNrr s10rMrceZdZUdZdZded< ded< ded< d ed < d ed < d ed< ded< ded< ded< ded< ded< ded< ded<y)ExceptionContextaEncapsulate information about an error condition in progress. This object exists solely to be passed to the :meth:`_events.DialectEvents.handle_error` event, supporting an interface that can be extended without backwards-incompatibility. rLr r`zOptional[Connection]rvzOptional[Engine]r/rEr{rrz Optional[_DBAPIAnyExecuteParams]rroriginal_exceptionzOptional[StatementError]sqlalchemy_exceptionzOptional[BaseException]chained_exceptionrDexecution_contextrr invalidate_pool_on_disconnect is_pre_pingN)rDrErFrQ __slots__rrLrMrNrr sI %$   "!  10 &% 32/.21&0$(' rMrcBeZdZUdZdZded<ed dZd dZd dZ y) AdaptedConnectionzInterface of an adapted connection object to support the DBAPI protocol. Used by asyncio dialects to provide a sync-style pep-249 facade on top of the asyncio connection/cursor API provided by the driver. .. versionadded:: 1.4.24  _connectionr*rc|jS)z@The connection object as returned by the driver after a connect.rrts rNdriver_connectionz#AdaptedConnection.driver_connectionb srMc8t||jS)aARun the awaitable returned by the given function, which is passed the raw asyncio driver connection. This is used to invoke awaitable-only methods on the driver connection within the context of a "synchronous" method, like a connection pool event handler. E.g.:: engine = create_async_engine(...) @event.listens_for(engine.sync_engine, "connect") def register_custom_types( dbapi_connection, # ... ): dbapi_connection.run_async( lambda connection: connection.set_type_codec( "MyCustomType", encoder, decoder, ... ) ) .. versionadded:: 1.4.30 .. seealso:: :ref:`asyncio_events_run_async` )r r)r\fns rN run_asynczAdaptedConnection.run_asyncg s<"T--.//rMc d|jzS)Nzrrts rN__repr__zAdaptedConnection.__repr__ s'$*:*:::rMNrC)rzCallable[[Any], Awaitable[_T]]rbr>r) rDrErFrQrrrrrrrLrMrNrrT s1!I''   0@;rMrN)rQ __future__renumrtypingrrrrr r r r r rrrrrrrrrrreventrpoolrr sql.compilerrrrutil.concurrencyr util.typingr!r"r#r$baser&r'r{r(rir)connectors.asyncior*r+r,excr-sqlr.r/r0r1r2r3r4 sql.elementsr5r6 sql.schemar7r8r9r sql.sqltypesr: sql.type_apir;r<util.langhelpersr=rar=r>rArPrVrrrr_CoreSingleExecuteParams_MutableCoreSingleExecuteParamsr_CoreAnyExecuteParams_DBAPISingleExecuteParamsr_DBAPIAnyExecuteParamsrrr_AnySingleExecuteParamsrc_AnyExecuteParamsCompiledCacheTypeSchemaTranslateMapType_ImmutableExecuteOptions _ParamStylerArrrirHrrrrrrrrrrrVersionInfoTypeTableKeyr rPrBr ConnectablerrrLrMrNrs8"! A/#7' )!%"# $;'"$ 5*1;&*,,#-'<&,)8 ~c3h'??@ T4, 0( 0 =h=2  @0(@0F#38,"0c":"#;<55"(3-1I"IJ  Xc]4477#         41*"3 ?3 # !=>(c2G !sC1B'B!CD %  S)#S 11 +. +.\N N$7i7t 1) 12& 3( L$7 L F$7F21FY1Fh I 99xc3h,- ## $U LkU Lp@m m `N$N$b 1[ 1% ccL4;4;rM