g fdZddlmZddlmZddlmZddlmZddlm Z ddlm Z ddlm Z dd lm Z dd lm Z dd lmZdd lmZdd lmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlm Z ddlm!Z!ddl"m#Z#ddl"m#Z#ddl"m$Z$ddl"m$Z$ddlm%Z%dd l&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(l0m1Z1d%d)l2m3Z3dd*lm4Z4dd+lm5Z5dd,l6m7Z7dd-l8m9Z9dd.l"m:Z:dd/l"m;Z;dd0l"mZ>dd3l"m?Z?dd4l@mAZAdd5l@mBZBdd6lCmDZDdd7lCmEZEdd8lCmFZFddlCmZGdd9lHmIZIdd:lJmKZKdd;lJmLZLeeeMeeMeffZNedZOGd?d@eZPGdAdBeZQGdCdDe+ZRGdEdFe+ZSGdGdHe+ZTeeMefZUeeMefZVeeUZWeeWeUfZXeeeeUfZYeeeeeWfZZeeZeYfZ[eeeMdFee\ee\ee\ee\ee]fZ^eYZ_eZZ`e[ZaeedIfZbeeeMeeMfZce%eMefZde)dJZeeeeMedKfZfe)dLZgGdMdNe,dOPZhe%eMefZieeheeMeffZjGdQdRe,ZkGdSdTe,ZlGdUdVe,ZmGdWdXe,ZnGdYdZenZoGd[d\enZpGd]d^enZqGd_d`enZrGdadbe,ZsGdcdde,ZtGdedfeZueee\eMfdgfZveeeMeMfZwGdhdieZxGdjdkZyGdldmZzGdndoeZ{e{Z|GdpdqZ}GdrdsZ~yt)uz1Define core interfaces used by the engine system.) annotations)Enum) ModuleType)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)_ListenerFnType) dispatcher)StatementError) Executable)_InsertManyValuesBatch) DDLCompiler)IdentifierPreparer)InsertmanyvaluesSentinelOpts)Linting) SQLCompiler) BindParameter) ClauseElement)Column)DefaultGenerator) SchemaItem)Integer) _TypeMemoDict) TypeEngine_Tr)boundc eZdZdZdZdZdZdZy) CacheStatsrr&rN)__name__ __module__ __qualname__ CACHE_HIT CACHE_MISSCACHING_DISABLED NO_CACHE_KEYNO_DIALECT_SUPPORTM/opt/hc_python/lib64/python3.12/site-packages/sqlalchemy/engine/interfaces.pyr@r@OsIJLrLr@c eZdZdZdZ dZ dZy) ExecuteStylezVindicates the :term:`DBAPI` cursor method that will be used to invoke a statement.rr&rN)rCrDrE__doc__EXECUTE EXECUTEMANYINSERTMANYVALUESrKrLrMrOrOWs$G1K6rLrOc<eZdZUdZd dZd dZd dZd dZded<y) DBAPIConnectionzprotocol representing a :pep:`249` database connection. .. versionadded:: 2.0 .. seealso:: `Connection Objects `_ - in :pep:`249` cyNrKselfs rMclosezDBAPIConnection.closeySrLcyrWrKrXs rMcommitzDBAPIConnection.commit{scrLcyrWrKrXs rMcursorzDBAPIConnection.cursor}sSrLcyrWrKrXs rMrollbackzDBAPIConnection.rollbacksrLbool autocommitNreturnNonere DBAPICursor) rCrDrErPrZr]r_ra__annotations__rKrLrMrUrUms !!(#rLrUceZdZdZy) DBAPITypezprotocol representing a :pep:`249` database type. .. versionadded:: 2.0 .. seealso:: `Type Objects `_ - in :pep:`249` N)rCrDrErPrKrLrMrkrks rLrkceZdZUdZe ddZeddZded<ded<ddZ d dd Z dd Z dd Z ddd Z dd Z ddZddZ d ddZd dZd!dZy)"rhzprotocol 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` NrKrXs rM descriptionzDBAPICursor.descriptions rLintcyrWrKrXs rMrowcountzDBAPICursor.rowcounts"rL arraysize lastrowidcyrWrKrXs rMrZzDBAPICursor.closer[rLNcyrWrKrY operation parameterss rMexecutezDBAPICursor.executerLcyrWrKrvs rM executemanyzDBAPICursor.executemanyrzrLcyrWrKrXs rMfetchonezDBAPICursor.fetchonerLcyrWrK)rYsizes rM fetchmanyzDBAPICursor.fetchmany3rLcyrWrKrXs rMfetchallzDBAPICursor.fetchallrrLcyrWrK)rYsizess rM setinputsizeszDBAPICursor.setinputsizesrrLcyrWrK)rYrcolumns rM setoutputsizezDBAPICursor.setoutputsizesSrLcyrWrK)rYprocnamerxs rMcallproczDBAPICursor.callprocsrLcyrWrKrXs rMnextsetzDBAPICursor.nextsetrrLcyrWrK)rYkeys rM __getattr__zDBAPICursor.__getattr__sCrL)re_DBAPICursorDescription)rerordrW)rwrrx#Optional[_DBAPISingleExecuteParams]rer)rwrrx_DBAPIMultiExecuteParamsrer)rez Optional[Any]).)rrore Sequence[Any])rer)rrrerf)rrrrrerf)rstrrxrrer)rezOptional[bool])rrrer)rCrDrErPpropertyrnrqrirZryr|r~rrrrrrrrKrLrMrhrhs       ""NN ;?8  -  ->,>@:=)6 -/rLrhr)qmarknumericnamedformatpyformatnumeric_dollarTypeEngine[Any]) SERIALIZABLEzREPEATABLE READzREAD COMMITTEDzREAD UNCOMMITTED AUTOCOMMITcreZdZUded<ded<ded<ded<ded <d ed <d ed <d ed <ded<ded<y)_CoreKnownExecutionOptionszOptional[CompiledCacheType]compiled_cacher logging_tokenIsolationLevelisolation_levelrb no_parametersstream_resultsromax_row_buffer yield_perinsertmanyvalues_page_sizez Optional[SchemaTranslateMapType]schema_translate_mappreserve_rowcountN)rCrDrErirKrLrMrrs=//##N ##::rLrF)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. rbalwayson_nullrostart incrementminvaluemaxvalue nominvalue nomaxvaluecycle Optional[int]cacheorderNrCrDrErPrirKrLrMrrsl L! M J(N)M,M,++ K% 1 K-rLrc(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. rsqltextNotRequired[bool] persistedNrrKrLrMrrHsL"! MrLrc|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. rnamertyperbnullable Optional[str]defaultr autoincrementNotRequired[Optional[str]]commentzNotRequired[ReflectedComputed]computedzNotRequired[ReflectedIdentity]identityNotRequired[Dict[str, Any]]dialect_optionsNrrKrLrMrrZsj I EN8 3$$ ('-, -, 10rLrc(eZdZUdZded< ded<y)ReflectedConstraintzDictionary representing the reflected elements corresponding to :class:`.Constraint` A base class for all constraints rrrrNrrKrLrMrrs  ''0rLrc(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. rrrrNrrKrLrMrrsL/00rLrc4eZdZUdZded< 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_indexrrNrrKrLrMrrs&;00L00rLrc(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_columnsrrNrrKrLrMrrs#"500KrLrcLeZdZUdZded< 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_schemarreferred_tablereferred_columnsroptionsNrrKrLrMrrs6#";""1*J ((ErLrcpeZdZUdZded< 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]] expressionsrbuniquerduplicates_constraintinclude_columnsz"NotRequired[Dict[str, Tuple[str]]]column_sortingrrNrrKrLrMrrs` %% (' L455A++7610ErLrceZdZUdZded<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. rtextNrrKrLrMrr&s rLrc eZdZdZdZ dZ dZy) BindTypingzDefine different methods of passing typing information for bound parameters in a statement to the database driver. .. versionadded:: 2.0 r&rrAN)rCrDrErPNONE SETINPUTSIZES RENDER_CASTSrKrLrMrr3s+ DM LrLr.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.< d e d/< d e d0< d e d1< d e d2< d3Zde d4< d e d5< d e d6< d e d7< d e d8< d e d9< d e d:< d e d;< d< d*e d?< d e d@< d e dA< d e dB< d e dC< d e dD< d e dE< d e dF< d e dG< d e dH< dIe dJ< d e dK< d e dL< d*e dM< d e dN< d e dO< d e dP< d e dQ< d e dR< dSZdTe dU< dVZdWe dX< e j"ZdYe dZ< d e d[< d e d\< d e d]< d^Zd_Zd e d`< d e da< ej,Z d e db< d e dc< dde de< dfe dg< dhe di< dhe dj< d e dk< d e dl< d e dm< d e dn<doe dp<ddqZddrZeddsZddtZdduZerddvZ d ddwZ dSdSdx ddyZ! d ddzZ"dSdSdx dd{Z# d dd|Z$dSdSdx dd}Z% d dd~Z& d ddZ' d ddZ( d ddZ) d ddZ* d ddZ+ddZ, d ddZ- d ddZ.dSdSdx ddZ/ d ddZ0dSdSdx ddZ1 d ddZ2dSdSdx ddZ3 d ddZ4dSdSdx ddZ5 d ddZ6dSdSdx 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^eddZ_eddZ`eddZaeddZbddZc ddZd ddZeddZfyS)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]dispatchrrdriverdialect_descriptionzOptional[ModuleType]dbapict)zsame as .dbapi, but is never None; will raise an error if no DBAPI was set up. .. versionadded:: 2.0 NotImplementedErrorrXs rM loaded_dbapizDialect.loaded_dbapi "##rLrb 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_level_on_connect_isolation_levelzType[ExecutionContext]execution_ctx_clsz4Union[Type[Tuple[Any, ...]], Type[Tuple[List[Any]]]]execute_sequence_formatsupports_alterromax_identifier_lengthsupports_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"##rLct)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 rM import_dbapizDialect.import_dbapi "##rLct)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)rYtypeobjs rMtype_descriptorzDialect.type_descriptor "##rLcy)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. NrKrY connections rM initializezDialect.initializes$ rLcyrWrK)rY method_names rM_overrides_defaultzDialect._overrides_default srLc 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`. rrYr[ table_nameschemakws rM get_columnszDialect.get_columns  &"##rL)rc 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 rrYr[rcrgrds rMget_multi_columnszDialect.get_multi_columns  4"##rLc 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`. rras rMget_pk_constraintzDialect.get_pk_constraint<rfrLc 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 rris rMget_multi_pk_constraintzDialect.get_multi_pk_constraintQ 2"##rLc 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`. rras rMget_foreign_keyszDialect.get_foreign_keysl $"##rLc 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 rris rMget_multi_foreign_keyszDialect.get_multi_foreign_keysrkrLc t)zReturn a list of table names for ``schema``. This is an internal dialect method. Applications should use :meth:`_engine.Inspector.get_table_names`. rrYr[rcrds rMget_table_nameszDialect.get_table_names "##rLc 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`. rrws rMget_temp_table_nameszDialect.get_temp_table_names "##rLc 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. rrws rMget_view_nameszDialect.get_view_names "##rLc 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 rrws rMget_materialized_view_namesz#Dialect.get_materialized_view_names "##rLc 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 rrws rMget_sequence_nameszDialect.get_sequence_namesrrLc 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`. rrws rMget_temp_view_nameszDialect.get_temp_view_namesr|rLc 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)rYr[rds rMget_schema_nameszDialect.get_schema_names "##rLc 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)rYr[ view_namercrds rMget_view_definitionzDialect.get_view_definition ""##rLc 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`. rras rM get_indexeszDialect.get_indexes rsrLc 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 rris rMget_multi_indexeszDialect.get_multi_indexes rkrLc 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`. rras rMget_unique_constraintszDialect.get_unique_constraints<rrLc 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 rris rMget_multi_unique_constraintsz$Dialect.get_multi_unique_constraintsOrkrLc 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`. rras rMget_check_constraintszDialect.get_check_constraintskrsrLc 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 rris rMget_multi_check_constraintsz#Dialect.get_multi_check_constraintsrkrLc 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`. rras rMget_table_optionszDialect.get_table_optionsrrLc 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 rris rMget_multi_table_optionszDialect.get_multi_table_optionsrprLc 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 rras rMget_table_commentzDialect.get_table_comments ."##rLc 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 rris rMget_multi_table_commentzDialect.get_multi_table_commentrkrLct)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. rrYrs rMnormalize_namezDialect.normalize_namerrLct)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 rMdenormalize_namezDialect.denormalize_namerrLc 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. rras rM has_tablezDialect.has_tablesN"##rLc 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)rYr[rb index_namercrds rM has_indexzDialect.has_index7rprLc 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)rYr[ sequence_namercrds rM has_sequencezDialect.has_sequenceRrrLc 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)rYr[ schema_namerds rM has_schemazDialect.has_schemaes *"##rLct)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. rrZs rM_get_server_version_infoz Dialect._get_server_version_info| "##rLct)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. rrZs rM_get_default_schema_namez Dialect._get_default_schema_nameryrLct)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`. rrYdbapi_connections rMdo_beginzDialect.do_beginrrLct)zProvide an implementation of ``connection.rollback()``, given a DB-API connection. :param dbapi_connection: a DBAPI connection, typically proxied within a :class:`.ConnectionFairy`. rrs rM do_rollbackzDialect.do_rollbackrrLct)zProvide an implementation of ``connection.commit()``, given a DB-API connection. :param dbapi_connection: a DBAPI connection, typically proxied within a :class:`.ConnectionFairy`. rrs rM do_commitzDialect.do_commitrrLct)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 rM do_terminatezDialect.do_terminaterrLct)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 rMdo_closezDialect.do_closer|rLctrWrrs rM_do_ping_w_eventzDialect._do_ping_w_eventrKrLct)zNping the DBAPI connection and return True if the connection is usable.rrs rMdo_pingzDialect.do_ping "##rLct)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)rYr_list_of_tuplescontexts rMdo_set_input_sizeszDialect.do_set_input_sizesrkrLct)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. rrXs rM create_xidzDialect.create_xidrrLct)zCreate a savepoint with the given name. :param connection: a :class:`_engine.Connection`. :param name: savepoint name. rrYr[rs rM do_savepointzDialect.do_savepointrrLct)zRollback a connection to the named savepoint. :param connection: a :class:`_engine.Connection`. :param name: savepoint name. rrs rMdo_rollback_to_savepointz Dialect.do_rollback_to_savepointryrLct)zRelease the named savepoint on a connection. :param connection: a :class:`_engine.Connection`. :param name: savepoint name. rrs rMdo_release_savepointzDialect.do_release_savepoints "##rLct)zBegin a two phase transaction on the given connection. :param connection: a :class:`_engine.Connection`. :param xid: xid rrYr[xids rMdo_begin_twophasezDialect.do_begin_twophase#rrLct)zPrepare a two phase transaction on the given connection. :param connection: a :class:`_engine.Connection`. :param xid: xid rrs rMdo_prepare_twophasezDialect.do_prepare_twophase-rrLct)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. rrYr[r is_preparedrecovers rMdo_rollback_twophasezDialect.do_rollback_twophase7rrLct)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 rMdo_commit_twophasezDialect.do_commit_twophaseJrsrLct)zRecover list of uncommitted prepared two phase transaction identifiers on the given connection. :param connection: a :class:`_engine.Connection`. rrZs rMdo_recover_twophasezDialect.do_recover_twophase^rrLct)zconvert executemany parameters for an INSERT into an iterator of statement/single execute values, used by the insertmanyvalues feature. r)rYr[r_ statementrxgeneric_setinputsizesrs rM!_deliver_insertmanyvalues_batchesz)Dialect._deliver_insertmanyvalues_batcheshs "##rLct)zSProvide an implementation of ``cursor.executemany(statement, parameters)``.rrYr_rrxrs rMdo_executemanyzDialect.do_executemanyxryrLct)zOProvide an implementation of ``cursor.execute(statement, parameters)``.rrs rM do_executezDialect.do_executeryrLct)z{Provide an implementation of ``cursor.execute(statement)``. The parameter collection should not be sent. r)rYr_rrs rMdo_execute_no_paramszDialect.do_execute_no_paramsrXrLct)zMReturn True if the given DB-API error indicates an invalid connectionr)rYer[r_s rM is_disconnectzDialect.is_disconnectrrLct)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)rYcargscparamss rMconnectzDialect.connect@"##rLc"|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_connectrMs rMon_connect_urlzDialect.on_connect_urlsv  rLcy)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. NrKrXs rMrzDialect.on_connect sfrLct)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 rMreset_isolation_levelzDialect.reset_isolation_level= rprLct)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)rYrlevels rMset_isolation_levelzDialect.set_isolation_levelX rrLct)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 rMget_isolation_levelzDialect.get_isolation_levelz sB"##rLct)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 rrY dbapi_conns rMget_default_isolation_levelz#Dialect.get_default_isolation_level s ("##rLct)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 rMget_isolation_level_valuesz"Dialect.get_isolation_level_values sT"##rLctrWr)rYrrs rM_assert_and_set_isolation_levelz'Dialect._assert_and_set_isolation_level rrLc|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. rKrRrNs rMget_dialect_clszDialect.get_dialect_cls s  rLc$|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 rMget_async_dialect_clszDialect.get_async_dialect_cls s"""3''rLcy)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 NrKrQs rMload_provisioningzDialect.load_provisioning rLcy)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. NrK)rRengines rMengine_createdzDialect.engine_created" rrLct)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 rrZs rMget_driver_connectionzDialect.get_driver_connection3 rrLct)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)rYroptss rMset_engine_execution_optionsz$Dialect.set_engine_execution_optionsB rXrLct)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)rYr[rs rM set_connection_execution_optionsz(Dialect.set_connection_execution_optionsP rrLct)z*return a Pool class to use for a given URLrrMs rMget_dialect_pool_classzDialect.get_dialect_pool_class_ s !##rL)rer)rezOptional[_ListenerFnType])rNr*reConnectArgsType)rVTypeEngine[_T]rer)r[r'rerf)r^rrerbrW) r[r'rbrrcrrdrrezList[ReflectedColumn]) r[r'rcrrgOptional[Collection[str]]rdrrez0Iterable[Tuple[TableKey, List[ReflectedColumn]]]) r[r'rbrrcrrdrrer) r[r'rcrrgr rdrrez8Iterable[Tuple[TableKey, ReflectedPrimaryKeyConstraint]]) r[r'rbrrcrrdrrez#List[ReflectedForeignKeyConstraint]) r[r'rcrrgr rdrrez>Iterable[Tuple[TableKey, List[ReflectedForeignKeyConstraint]]])r[r'rcrrdrrer)r[r'rdrrer) r[r'rrrcrrdrrer) r[r'rbrrcrrdrrezList[ReflectedIndex]) r[r'rcrrgr rdrrez/Iterable[Tuple[TableKey, List[ReflectedIndex]]]) r[r'rbrrcrrdrrezList[ReflectedUniqueConstraint]) r[r'rcrrgr rdrrez:Iterable[Tuple[TableKey, List[ReflectedUniqueConstraint]]]) r[r'rbrrcrrdrrezList[ReflectedCheckConstraint]) r[r'rcrrgr rdrrez9Iterable[Tuple[TableKey, List[ReflectedCheckConstraint]]]) r[r'rbrrcrrdrreDict[str, Any]) r[r'rcrrgr rdrrez)Iterable[Tuple[TableKey, Dict[str, Any]]]) r[r'rbrrcrrdrrer) r[r'rcrrgr rdrrez0Iterable[Tuple[TableKey, ReflectedTableComment]])rrrer) r[r'rbrrcrrdrrerb) r[r'rbrrrrcrrdrrerb) r[r'rrrcrrdrrerb)r[r'rrrdrrerb)r[r'rer)r[r'rer)rrrerf)rrUrerf)rrUrerb)r_rhr_GenericSetInputSizesTyperExecutionContextrerrer)r[r'rrrerf)r[r'rrrerf)TF) r[r'rrrrbrrbrerf)r[r'rez List[Any])r[r'r_rhrrrxrrz#Optional[_GenericSetInputSizesType]rr#rez Iterator[_InsertManyValuesBatch]) r_rhrrrxrrOptional[ExecutionContext]rerf) r_rhrrrxrrr%rerf)r_rhrrrr%rerf)r Exceptionr[z7Optional[Union[PoolProxiedConnection, DBAPIConnection]]r_Optional[DBAPICursor]rerb)rrrrrerU)rNr*reOptional[Callable[[Any], Any]])rer()rrUrrrerf)rrUrer)rrUrer)rrUrezList[IsolationLevel])rrUrrrerf)rNr*re Type[Dialect]rdrr(rerf)r[rUrer)rr(rCoreExecuteOptionsParameterrerf)r[r'rr+rerf)rNr*re Type[Pool])grCrDrErPr@rFrGrHrIrJrirnon_memoized_propertyrrr5r7 EMPTY_DICTr8 _has_eventsr<rr bind_typingrJrO classmethodrSrWr\rr_rerjrmrorrrurxr{r~rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr r rrrrrrrrKrLrMrrss  $$I&&J!22**L#66!! I K2 , $ $@O))C##C33 )('&,+ 32 '&65E":9--O41"&&?! #'&  "!: $$$-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$)$ $,*$)*$ *$X$)$2@$ $   (($  8  $ $ $$? $  $ $$ $,G $  $$rLrcPeZdZdZddZd 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)rN)rYrNkwargss rM__init__zCreateEnginePlugin.__init__ s 2rLct)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 rrMs rM update_urlzCreateEnginePlugin.update_url/ rrLcy)zparse and modify dialect kwargsNrK)rY dialect_cls dialect_argss rMhandle_dialect_kwargsz(CreateEnginePlugin.handle_dialect_kwargs@ rrLcy)zparse and modify pool kwargsNrK)rYpool_cls pool_argss rMhandle_pool_kwargsz%CreateEnginePlugin.handle_pool_kwargsE rrLcy)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. NrK)rYrs rMrz!CreateEnginePlugin.engine_createdJ rrLN)rNr*r5r!)rNr*rer*)r:r)r;r!rerf)r>r,r?r!rerfr*) rCrDrErPr6r8r<r@rrKrLrMr3r3d sRm^6$".(.8F. . +"+/=+ +  rLr3c0eZdZUdZded< 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)Ar#zRA messenger object for a Dialect that corresponds to a single execution. r(rr'r[root_connectionrdialectrhr_zOptional[Compiled]compiledrrzOptional[Executable]invoked_statement_AnyMultiExecuteParamsrxrbrisinsertisupdaterO execute_styler|z;util.generic_fn_descriptor[Optional[Sequence[Column[Any]]]] prefetch_colspostfetch_cols_ExecuteOptionsexecution_optionsctrWr)rRrDr[rrN compiled_ddls rM _init_ddlzExecutionContext._init_ddl rrLc trWr) rRrDr[rrNrErxrFextracted_parameters cache_hits rM_init_compiledzExecutionContext._init_compiled rrLctrWr)rRrDr[rrNrrxs rM_init_statementz ExecutionContext._init_statement ryrLctrWr)rRrDr[rrNs rM _init_defaultzExecutionContext._init_default rrLctrWr)rYrrtype_s rM _exec_defaultzExecutionContext._exec_default rrLctrWrrXs rM_prepare_set_input_sizesz)ExecutionContext._prepare_set_input_sizes rrLctrWrrXs rM_get_cache_statsz!ExecutionContext._get_cache_stats rKrLctrWrrXs rM_setup_result_proxyz$ExecutionContext._setup_result_proxy rKrLct)zKgiven a :class:`.Sequence`, invoke it and return the next int valuer)rYseqr[s rM fire_sequencezExecutionContext.fire_sequence rrLct)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. rrXs rM create_cursorzExecutionContext.create_cursor rrLct)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. rrXs rMpre_execzExecutionContext.pre_exec rrLct)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)rYout_param_namess rMget_out_parameter_valuesz)ExecutionContext.get_out_parameter_values sD"##rLct)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. rrXs rM post_execzExecutionContext.post_exec1 rrLct)zQReceive a DBAPI exception which occurred upon execute, result fetch, etc.r)rYrs rMhandle_dbapi_exceptionz'ExecutionContext.handle_dbapi_exception; s "##rLct)zjReturn True if the last INSERT or UPDATE row contained inlined or database-side defaults. rrXs rMlastrow_has_defaultsz%ExecutionContext.lastrow_has_defaultsA s "##rLct)zReturn the DBAPI ``cursor.rowcount`` value, or in some cases an interpreted value. See :attr:`_engine.CursorResult.rowcount` for details on this. rrXs rM get_rowcountzExecutionContext.get_rowcountH rrLct)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)rYr_s rMfetchall_for_returningz'ExecutionContext.fetchall_for_returningR rTrLN) rDrr[r'rrrNrMrPr0rer#)rDrr[r'rrrNrMrEr4rx_CoreMultiExecuteParamsrFr.rSz&Optional[Sequence[BindParameter[Any]]]rTr@rer#)rDrr[r'rrrNrMrrrxrrer#) rDrr[r'rrrNrMrer#)rzOptional[Column[Any]]rr8r[zOptional[TypeEngine[Any]]rer)rez0Optional[List[Tuple[str, Any, TypeEngine[Any]]]]rer)rezCursorResult[Any])rdSequence_SchemaItemr[r:rerorgrd)rkr6rer)r BaseExceptionrerf)rerb)rer)r_rhrer)rCrDrErPrir1rQr@rHrUrWrYr\r^r`rbrergrirlrnrprrrtrvrKrLrMr#r#T s N8  I 6 4  NC,+'&=N-N-ON9PO'&K$$$0 $ + $ " $ $$!+ ; ; $ $ $0 $ + $  $, $& $E $ $  $ $ $ $ $0 $ + $  $- $  $ $$$$0 $ + $  $$$%$"$) $ $$ 9$ $$$ $$"$,"$ "$H$$ $$$rLr#ceZdZUdZded<y)ConnectionEventsTargetzAn object which can accept events from :class:`.ConnectionEvents`. Includes :class:`_engine.Connection` and :class:`_engine.Engine`. .. versionadded:: 2.0 z"dispatcher[ConnectionEventsTarget]rNrrKrLrMr|r|e s10rLr|ceZdZUdZdZded< 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. rKrrDzOptional[Connection]r[zOptional[Engine]rr'r_rrz Optional[_DBAPIAnyExecuteParams]rxrzoriginal_exceptionzOptional[StatementError]sqlalchemy_exceptionzOptional[BaseException]chained_exceptionr%execution_contextrbrinvalidate_pool_on_disconnect is_pre_pingN)rCrDrErP __slots__rirKrLrMr~r~t sI %$   "!  10 &% 32/.21&0$(' rLr~cBeZdZUdZdZded<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  _connectionrrc|jS)z@The connection object as returned by the driver after a connect.rrXs rMdriver_connectionz#AdaptedConnection.driver_connection( srLc8t||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)rYfns rM run_asynczAdaptedConnection.run_async- s<"T--.//rLc d|jzS)NzrrXs rM__repr__zAdaptedConnection.__repr__M s'$*:*:::rLNr$)rzCallable[[Any], Awaitable[_T]]rer=rx) rCrDrErPrrirrrrrKrLrMrr s1!I   0@;rLrN)rP __future__renumrtypesrtypingrrrr r r r r rrrrrrrrrrrreventrpoolrr sql.compilerrrr util.concurrencyr! util.typingr"r#r$r%baser'r(r_r)rNr*r+r,excr-sqlr.r/r0r1r2r3r4 sql.elementsr5r6 sql.schemar7r8r9ry sql.sqltypesr: sql.type_apir;r<rrr=r@rOrUrkrh_CoreSingleExecuteParams_MutableCoreSingleExecuteParamsrw_CoreAnyExecuteParams_DBAPISingleExecuteParamsr_DBAPIAnyExecuteParamsrorbr_AnySingleExecuteParamsrG_AnyExecuteParamsCompiledCacheTypeSchemaTranslateMapType_ImmutableExecuteOptions _ParamStyler"rrrMr+rrrrrrrrrrrVersionInfoTypeTableKeyrr3r#r| Connectabler~rrKrLrMrs8"! (/#7' )!%"# $'"$ 5*1;&*,,#-'<&,) ~c3h'??@ T4,h.  @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,- ## $n$kn$b?m m `N$N$b 1[ 1% ccL4;4;rL