OwlCyberSecurity - MANAGER
Edit File: base.cpython-312.pyc
� ����_��g��������������������������U�d�Z�ddlmZ�ddlZddlZddlZddlmZ�ddlmZ�ddlmZ�ddlm Z �ddlm Z �dd lmZ�dd lmZ�ddlm Z �ddlmZ�dd lmZ�ddlmZ�ddlmZ�ddlmZ�ddlmZ�ddlmZ�ddlmZ�ddlmZ�ddlmZ�ddlmZ�ddlmZ�ddlmZ�ddlmZ�ddlmZ�ddlmZ�ddl m!Z!�ddl m"Z"�dd l m#Z#�dd!l mZ�dd"l$m%Z%�dd!l$mZ&�ejN������������������r�dd#l m(Z(�dd$l m)Z)�dd%lm*Z*�dd&lm+Z+�dd'lm,Z,�dd(lm-Z-�dd)lm.Z.�dd*lm/Z/�dd+lm0Z0�dd,lm1Z1�dd-lm2Z2�dd.lm3Z3�dd/lm4Z4�dd0lm5Z5�dd1l6m7Z7�dd2l8m9Z9�dd3l:m;Z;�dd4l#m<Z<�dd5l=m>Z>�dd6l=m?Z?�dd7l=m@Z@�dd8l$mAZA�dd9lBmCZC�dd:lDmEZE�dd;lFmGZG�dd<lFmHZH�dd=lFmIZI�dd>lJmKZK�dd?lLmMZM�dd@lLmNZN�ddAlLmOZO�ddBlPmQZQ��edCe�D�������ZRej�������������������ZTdEeUdF<���ej�������������������ZVdGeUdH<����G�dI��dJee"j�������������������dK����������ZX�G�dL��dMe�������ZY�G�dN��dOe�������ZZ�G�dP��dQeZ�������Z[�G�dR��dSeZ�������Z\�G�dT��dUe[�������Z]�G�dV��dWee#j�������������������e"j�������������������dK����������Z_�G�dX��dYe#j��������������������������Z`�G�dZ��d[e`e_�������Zaeae__b��������y)\zBDefines :class:`_engine.Connection` and :class:`_engine.Engine`. �����)�annotationsN)�Any)�Callable)�cast)�Iterable)�Iterator)�List)�Mapping)�NoReturn)�Optional)�overload)�Tuple)�Type)�TypeVar)�Union����)� BindTyping)�ConnectionEventsTarget)�DBAPICursor)�ExceptionContext)�ExecuteStyle)�ExecutionContext)�IsolationLevel)�_distill_params_20)�_distill_raw_params)�TransactionalContext����)�exc)� inspection)�log)�util)�compiler)�CursorResult)�ScalarResult)�_AnyExecuteParams)�_AnyMultiExecuteParams)�_CoreAnyExecuteParams)�_CoreMultiExecuteParams)�_CoreSingleExecuteParams)�_DBAPIAnyExecuteParams)�_DBAPISingleExecuteParams)�_ExecuteOptions)�CompiledCacheType)�CoreExecuteOptionsParameter)�Dialect)�SchemaTranslateMapType)� Inspector)�URL)� dispatcher)� _EchoFlagType)�_ConnectionFairy)�Pool)�PoolProxiedConnection)� Executable)� _InfoType)�Compiled)�ExecutableDDLElement)� SchemaDropper)�SchemaGenerator)�FunctionElement)�DefaultGenerator)� HasSchemaAttr)� SchemaItem)�TypedReturnsRows�_T)�boundr,����_EMPTY_EXECUTION_OPTSzMapping[str, Any]� NO_OPTIONSc������������������������e�Zd�ZU�dZded<���ded<���dZdZded <���d Zded<���d ed<���ded<���ded<��� � � � �da � � � � � � � � �dbd�ZdZ ded<���dcd�Z dcd�Zeddd���������Z ded�Zdfd�Zdgd�Zedddd d ddddd d� � � � � � � � � � � � � � � � � � � � � � � �dhd���������Zedid���������Zdid �Zdjd!�Zedkd"���������Zedkd#���������Zedkd$���������Zedld%���������Zdmd&�Zednd'���������Zdod(�Zdld)�Zedpd*���������Zdqdrd+�Zdsd,�Zdsd-�Zdtd.�Z dud/�Z!dqdvd0�Z"dsd1�Z#dsd2�Z$dwd3�Z%dxdyd4�Z&dxdyd5�Z'dkd6�Z(dkd7�Z)dkd8�Z*dtd9�Z+dud:�Z,dzd;�Z-d{d<�Z.d|d=�Z/dsd>�Z0dsd?�Z1dqd}d@�Z2d~dA�Z3d~dB�Z4ddC�Z5d�dD�Z6d�dE�Z7d�dF�Z8dsdG�Z9e �dqddH� � � � � � � �d�dI���������Z:e �dqddH� � � � � � � �d�dJ���������Z: �dqddH� � � � � � � �d�dK�Z:e �dqddH� � � � � � � �d�dL���������Z;e �dqddH� � � � � � � �d�dM���������Z; �dqddH� � � � � � � �d�dN�Z;e �dqddH� � � � � � � �d�dO���������Z<e �dqddH� � � � � � � �d�dP���������Z< �dqddH� � � � � � � �d�dQ�Z< � � � � � � � �d�dR�Z= � � � � � � � �d�dS�Z> � � � � � � � �d�dT�Z? � � � � � � � �d�dU�Z@ � � � � � � � �d�dV�ZAeBf � � � � � � �d�dW�ZC � �d� � � � � � � �d�dX�ZD � � � � � � � � � � � � � � � �d�dY�ZE � � � � � � � � � �d�dZ�ZF � � � � � �d�d[�ZG �dq � � � � � � � � �d�d\�ZHd�d]�ZId ZJd ZK �dx � � � � � � � � � � � � �d�d^�ZLeM � � � �d� � � � � � � � � � � � � �d�d_���������ZN � � � � � � � �d�d`�ZOy)�� Connectiona:��Provides high-level functionality for a wrapped DB-API connection. The :class:`_engine.Connection` object is procured by calling the :meth:`_engine.Engine.connect` method of the :class:`_engine.Engine` object, and provides services for execution of SQL statements as well as transaction control. The Connection object is **not** thread-safe. While a Connection can be shared among threads using properly synchronized access, it is still possible that the underlying DBAPI connection may not support shared access between threads. Check the DBAPI documentation for details. The Connection object represents a single DBAPI connection checked out from the connection pool. In this state, the connection pool has no affect upon the connection, including its expiration or timeout state. For the connection pool to properly manage connections, connections should be returned to the connection pool (i.e. ``connection.close()``) whenever the connection is not in use. .. index:: single: thread safety; Connection r/����dialect�"dispatcher[ConnectionEventsTarget]�dispatchzsqlalchemy.engine.ConnectionNzOptional[TransactionalContext]�_trans_context_managerF�Optional[PoolProxiedConnection]�_dbapi_connectionr,����_execution_options�Optional[RootTransaction]�_transaction�Optional[NestedTransaction]�_nested_transactionc���������������������||�_���������|j������������������x|�_��������}|� �|j��������������������������|�_��������n||�_��������dx|�_��������|�_ ��������d|�_ ��������d|�_��������||�_��������||�_ ��������|�j�������������������j��������������������������|�_��������|�*|�j ������������������j#������������������|j �������������������������|�_��������|xs�|du�xr�|j$������������������|�_��������|j&������������������|�_��������|�j$������������������s|�j�������������������j$������������������r|�j ������������������j)������������������|���������yy#�|j������������������j ������������������$�r}t��������j������������������|||����������d}~ww�xY�w)zConstruct a new Connection.Nr���F)�enginerI����raw_connectionrN����loaded_dbapi�ErrorrH����$_handle_dbapi_exception_noconnectionrQ���rS����_Connection__savepoint_seq�_Connection__in_begin�_Connection__can_reconnect�_allow_autobegin�_should_log_info�_echorK����_join�_has_eventsrO����engine_connect)�selfrU���� connectionra����_allow_revalidater]���rI����errs��� �G/opt/hc_python/lib64/python3.12/site-packages/sqlalchemy/engine/base.py�__init__zConnection.__init__����s=���������!'���/���w��� �)/�)>�)>�)@��&��&0�D�"�7;�;���D�4� ������0��� 0����[�[�1�1�3�� ����!�M�M�/�/����@�D�M�&�� ��4��6�F�$6�$6�� ���#)�";�";������t�{�{�6�6��M�M�(�(��.�� 7��7��'�'�-�-�� ��?�?���&����� �s����D��E�4E�Er����_message_formatterc�����������������������|�j�������������������}|r�||�������}t��������j������������������rdt��������j������������������z���|d<����|�j������������������j ������������������j������������������|g|��i�|���y��Nr���� stacklevel)ri���r ���� STACKLEVEL�STACKLEVEL_OFFSETrU����logger�info�rc����message�arg�kw�fmts��� rg���� _log_infozConnection._log_info����sY�������%�%����'�l�G��>�>� �3�#8�#8�8�B�|�����������4�#�4��4�����c�����������������������|�j�������������������}|r�||�������}t��������j������������������rdt��������j������������������z���|d<����|�j������������������j ������������������j������������������|g|��i�|���y�rk���)ri���r ���rm���rn���rU���ro����debugrq���s��� rg���� _log_debugzConnection._log_debug����sY�������%�%����'�l�G��>�>� �3�#8�#8�8�B�|�� ������ � ��5�3�5�"�5rw���c�����������������>�����|�j�������������������j������������������dd��������}|S�)N�schema_translate_map)rO����get)rc���r|���s��� rg����_schema_translate_mapz Connection._schema_translate_map����s(������� �#�#�'�'�(>��E�� ��$�#rw���c����������������������|j�������������������}|�j������������������j������������������dd�������}|r||v�r|j������������������r||���S�|S�)ztReturn the schema name for the given schema item taking into account current schema translate map. r|���N)�schemarO���r}����_use_schema_map)rc����obj�namer|���s��� rg����schema_for_objectzConnection.schema_for_object����sP��������z�z���#�#�'�'�(>��E�� � � !��,�,��#�#�'��-�-��Krw���c����������������������|�S��N���rc���s��� rg���� __enter__zConnection.__enter__����s�������rw���c�����������������$�����|�j���������������������������y�r����)�close)rc����type_�value� tracebacks��� rg����__exit__zConnection.__exit__����s������� � �rw���.) �compiled_cache� logging_token�isolation_level� no_parameters�stream_results�max_row_buffer� yield_per�insertmanyvalues_page_sizer|����preserve_rowcountc������� ���������������y�r����r����)rc���r����r����r����r����r����r����r����r����r|���r�����opts��� rg����execution_optionszConnection.execution_options����s�������rw���c�����������������������y�r����r�����rc���r����s��� rg���r����zConnection.execution_options����s������;>rw���c����������������������|�j�������������������s|�j������������������j�������������������r|�j������������������j������������������|�|��������|�j������������������j������������������|�������|�_��������|�j������������������j������������������|�|��������|�S�)a�0��Set non-SQL options for the connection which take effect during execution. This method modifies this :class:`_engine.Connection` **in-place**; the return value is the same :class:`_engine.Connection` object upon which the method is called. Note that this is in contrast to the behavior of the ``execution_options`` methods on other objects such as :meth:`_engine.Engine.execution_options` and :meth:`_sql.Executable.execution_options`. The rationale is that many such execution options necessarily modify the state of the base DBAPI connection in any case so there is no feasible means of keeping the effect of such an option localized to a "sub" connection. .. versionchanged:: 2.0 The :meth:`_engine.Connection.execution_options` method, in contrast to other objects with this method, modifies the connection in-place without creating copy of it. As discussed elsewhere, the :meth:`_engine.Connection.execution_options` method accepts any arbitrary parameters including user defined names. All parameters given are consumable in a number of ways including by using the :meth:`_engine.Connection.get_execution_options` method. See the examples at :meth:`_sql.Executable.execution_options` and :meth:`_engine.Engine.execution_options`. The keywords that are currently recognized by SQLAlchemy itself include all those listed under :meth:`.Executable.execution_options`, as well as others that are specific to :class:`_engine.Connection`. :param compiled_cache: Available on: :class:`_engine.Connection`, :class:`_engine.Engine`. A dictionary where :class:`.Compiled` objects will be cached when the :class:`_engine.Connection` compiles a clause expression into a :class:`.Compiled` object. This dictionary will supersede the statement cache that may be configured on the :class:`_engine.Engine` itself. If set to None, caching is disabled, even if the engine has a configured cache size. Note that the ORM makes use of its own "compiled" caches for some operations, including flush operations. The caching used by the ORM internally supersedes a cache dictionary specified here. :param logging_token: Available on: :class:`_engine.Connection`, :class:`_engine.Engine`, :class:`_sql.Executable`. Adds the specified string token surrounded by brackets in log messages logged by the connection, i.e. the logging that's enabled either via the :paramref:`_sa.create_engine.echo` flag or via the ``logging.getLogger("sqlalchemy.engine")`` logger. This allows a per-connection or per-sub-engine token to be available which is useful for debugging concurrent connection scenarios. .. versionadded:: 1.4.0b2 .. seealso:: :ref:`dbengine_logging_tokens` - usage example :paramref:`_sa.create_engine.logging_name` - adds a name to the name used by the Python logger object itself. :param isolation_level: Available on: :class:`_engine.Connection`, :class:`_engine.Engine`. Set the transaction isolation level for the lifespan of this :class:`_engine.Connection` object. Valid values include those string values accepted by the :paramref:`_sa.create_engine.isolation_level` parameter passed to :func:`_sa.create_engine`. These levels are semi-database specific; see individual dialect documentation for valid levels. The isolation level option applies the isolation level by emitting statements on the DBAPI connection, and **necessarily affects the original Connection object overall**. The isolation level will remain at the given setting until explicitly changed, or when the DBAPI connection itself is :term:`released` to the connection pool, i.e. the :meth:`_engine.Connection.close` method is called, at which time an event handler will emit additional statements on the DBAPI connection in order to revert the isolation level change. .. note:: The ``isolation_level`` execution option may only be established before the :meth:`_engine.Connection.begin` method is called, as well as before any SQL statements are emitted which would otherwise trigger "autobegin", or directly after a call to :meth:`_engine.Connection.commit` or :meth:`_engine.Connection.rollback`. A database cannot change the isolation level on a transaction in progress. .. note:: The ``isolation_level`` execution option is implicitly reset if the :class:`_engine.Connection` is invalidated, e.g. via the :meth:`_engine.Connection.invalidate` method, or if a disconnection error occurs. The new connection produced after the invalidation will **not** have the selected isolation level re-applied to it automatically. .. seealso:: :ref:`dbapi_autocommit` :meth:`_engine.Connection.get_isolation_level` - view current actual level :param no_parameters: Available on: :class:`_engine.Connection`, :class:`_sql.Executable`. When ``True``, if the final parameter list or dictionary is totally empty, will invoke the statement on the cursor as ``cursor.execute(statement)``, not passing the parameter collection at all. Some DBAPIs such as psycopg2 and mysql-python consider percent signs as significant only when parameters are present; this option allows code to generate SQL containing percent signs (and possibly other characters) that is neutral regarding whether it's executed by the DBAPI or piped into a script that's later invoked by command line tools. :param stream_results: Available on: :class:`_engine.Connection`, :class:`_sql.Executable`. Indicate to the dialect that results should be "streamed" and not pre-buffered, if possible. For backends such as PostgreSQL, MySQL and MariaDB, this indicates the use of a "server side cursor" as opposed to a client side cursor. Other backends such as that of Oracle Database may already use server side cursors by default. The usage of :paramref:`_engine.Connection.execution_options.stream_results` is usually combined with setting a fixed number of rows to to be fetched in batches, to allow for efficient iteration of database rows while at the same time not loading all result rows into memory at once; this can be configured on a :class:`_engine.Result` object using the :meth:`_engine.Result.yield_per` method, after execution has returned a new :class:`_engine.Result`. If :meth:`_engine.Result.yield_per` is not used, the :paramref:`_engine.Connection.execution_options.stream_results` mode of operation will instead use a dynamically sized buffer which buffers sets of rows at a time, growing on each batch based on a fixed growth size up until a limit which may be configured using the :paramref:`_engine.Connection.execution_options.max_row_buffer` parameter. When using the ORM to fetch ORM mapped objects from a result, :meth:`_engine.Result.yield_per` should always be used with :paramref:`_engine.Connection.execution_options.stream_results`, so that the ORM does not fetch all rows into new ORM objects at once. For typical use, the :paramref:`_engine.Connection.execution_options.yield_per` execution option should be preferred, which sets up both :paramref:`_engine.Connection.execution_options.stream_results` and :meth:`_engine.Result.yield_per` at once. This option is supported both at a core level by :class:`_engine.Connection` as well as by the ORM :class:`_engine.Session`; the latter is described at :ref:`orm_queryguide_yield_per`. .. seealso:: :ref:`engine_stream_results` - background on :paramref:`_engine.Connection.execution_options.stream_results` :paramref:`_engine.Connection.execution_options.max_row_buffer` :paramref:`_engine.Connection.execution_options.yield_per` :ref:`orm_queryguide_yield_per` - in the :ref:`queryguide_toplevel` describing the ORM version of ``yield_per`` :param max_row_buffer: Available on: :class:`_engine.Connection`, :class:`_sql.Executable`. Sets a maximum buffer size to use when the :paramref:`_engine.Connection.execution_options.stream_results` execution option is used on a backend that supports server side cursors. The default value if not specified is 1000. .. seealso:: :paramref:`_engine.Connection.execution_options.stream_results` :ref:`engine_stream_results` :param yield_per: Available on: :class:`_engine.Connection`, :class:`_sql.Executable`. Integer value applied which will set the :paramref:`_engine.Connection.execution_options.stream_results` execution option and invoke :meth:`_engine.Result.yield_per` automatically at once. Allows equivalent functionality as is present when using this parameter with the ORM. .. versionadded:: 1.4.40 .. seealso:: :ref:`engine_stream_results` - background and examples on using server side cursors with Core. :ref:`orm_queryguide_yield_per` - in the :ref:`queryguide_toplevel` describing the ORM version of ``yield_per`` :param insertmanyvalues_page_size: Available on: :class:`_engine.Connection`, :class:`_engine.Engine`. Number of rows to format into an INSERT statement when the statement uses "insertmanyvalues" mode, which is a paged form of bulk insert that is used for many backends when using :term:`executemany` execution typically in conjunction with RETURNING. Defaults to 1000. May also be modified on a per-engine basis using the :paramref:`_sa.create_engine.insertmanyvalues_page_size` parameter. .. versionadded:: 2.0 .. seealso:: :ref:`engine_insertmanyvalues` :param schema_translate_map: Available on: :class:`_engine.Connection`, :class:`_engine.Engine`, :class:`_sql.Executable`. A dictionary mapping schema names to schema names, that will be applied to the :paramref:`_schema.Table.schema` element of each :class:`_schema.Table` encountered when SQL or DDL expression elements are compiled into strings; the resulting schema name will be converted based on presence in the map of the original name. .. seealso:: :ref:`schema_translating` :param preserve_rowcount: Boolean; when True, the ``cursor.rowcount`` attribute will be unconditionally memoized within the result and made available via the :attr:`.CursorResult.rowcount` attribute. Normally, this attribute is only preserved for UPDATE and DELETE statements. Using this option, the DBAPIs rowcount value can be accessed for other kinds of statements such as INSERT and SELECT, to the degree that the DBAPI supports these statements. See :attr:`.CursorResult.rowcount` for notes regarding the behavior of this attribute. .. versionadded:: 2.0.28 .. seealso:: :meth:`_engine.Engine.execution_options` :meth:`.Executable.execution_options` :meth:`_engine.Connection.get_execution_options` :ref:`orm_queryguide_execution_options` - documentation on all ORM-specific execution options )ra���rU���rK���� set_connection_execution_optionsrO����unionrI���r����s��� rg���r����zConnection.execution_options��s`������B����t�{�{�6�6��M�M�:�:�4��E�"&�"9�"9�"?�"?��"D������5�5�d�C�@��rw���c����������������������|�j�������������������S�)z�Get the non-SQL options which will take effect during execution. .. versionadded:: 1.3 .. seealso:: :meth:`_engine.Connection.execution_options` �rO���r����s��� rg����get_execution_optionsz Connection.get_execution_options�����������&�&�&rw���c�����������������>�����|�j�������������������}|d�uxr�|j������������������S�r����)rN����is_valid�rc����pool_proxied_connections��� rg����)_still_open_and_dbapi_connection_is_validz4Connection._still_open_and_dbapi_connection_is_valid��s)������"&�"8�"8��#�4�/�� 1�'�0�0� rw���c�����������������<�����|�j�������������������du�xr �|�j�������������������S�)z)Return True if this connection is closed.N�rN���r\���r����s��� rg����closedzConnection.closed��s#��������%�%��-�J�d�6J�6J�2J�Jrw���c�����������������>�����|�j�������������������}|du�xr�|�j������������������S�)z�Return True if this connection was invalidated. This does not indicate whether or not the connection was invalidated at the pool level, however Nr����r����s��� rg����invalidatedzConnection.invalidated!��s&������$�#'�"8�"8��&�$�.�G�4�3G�3G�Grw���c�����������������������|�j�������������������� �|�j��������������������������S�|�j�������������������S�#�t��������j������������������t��������j������������������f$�r���t ��������$�r}|�j ������������������|dddd��������Y�d}~yd}~ww�xY�w)aV��The underlying DB-API connection managed by this Connection. This is a SQLAlchemy connection-pool proxied connection which then has the attribute :attr:`_pool._ConnectionFairy.dbapi_connection` that refers to the actual driver connection. .. seealso:: :ref:`dbapi_connections` N)rN����_revalidate_connectionr����PendingRollbackError�ResourceClosedError� BaseException�_handle_dbapi_exception�rc����es��� rg���rd���zConnection.connection6��s|������ ��!�!�)� H��2�2�4�4���)�)�)����,�,�c�.E�.E�F�� �� �� H��,�,�Q��d�D�$�G�G�� H�s����*��,A5�A0�0A5c�����������������������|�j�������������������j������������������}|�J�� �|�j������������������j������������������|�������S�#�t��������$�r}|�j������������������|dddd��������Y�d}~yd}~ww�xY�w)a���Return the current **actual** isolation level that's present on the database within the scope of this connection. This attribute will perform a live SQL operation against the database in order to procure the current isolation level, so the value returned is the actual level on the underlying DBAPI connection regardless of how this state was set. This will be one of the four actual isolation modes ``READ UNCOMMITTED``, ``READ COMMITTED``, ``REPEATABLE READ``, ``SERIALIZABLE``. It will **not** include the ``AUTOCOMMIT`` isolation level setting. Third party dialects may also feature additional isolation level settings. .. note:: This method **will not report** on the ``AUTOCOMMIT`` isolation level, which is a separate :term:`dbapi` setting that's independent of **actual** isolation level. When ``AUTOCOMMIT`` is in use, the database connection still has a "traditional" isolation mode in effect, that is typically one of the four values ``READ UNCOMMITTED``, ``READ COMMITTED``, ``REPEATABLE READ``, ``SERIALIZABLE``. Compare to the :attr:`_engine.Connection.default_isolation_level` accessor which returns the isolation level that is present on the database at initial connection time. .. seealso:: :attr:`_engine.Connection.default_isolation_level` - view default level :paramref:`_sa.create_engine.isolation_level` - set per :class:`_engine.Engine` isolation level :paramref:`.Connection.execution_options.isolation_level` - set per :class:`_engine.Connection` isolation level N)rd����dbapi_connectionrI����get_isolation_levelr����r����)rc���r����r����s��� rg���r����zConnection.get_isolation_levelP��sh������J� �?�?�;�;���+�+�+� D��<�<�3�3�4D�E�E���� D��(�(��D�$��d�C�C�� D�s����7�� A��A�Ac�����������������.�����|�j�������������������j������������������S�)a���The initial-connection time isolation level associated with the :class:`_engine.Dialect` in use. This value is independent of the :paramref:`.Connection.execution_options.isolation_level` and :paramref:`.Engine.execution_options.isolation_level` execution options, and is determined by the :class:`_engine.Dialect` when the first connection is created, by performing a SQL query against the database for the current isolation level before any additional commands have been emitted. Calling this accessor does not invoke any new SQL queries. .. seealso:: :meth:`_engine.Connection.get_isolation_level` - view current actual isolation level :paramref:`_sa.create_engine.isolation_level` - set per :class:`_engine.Engine` isolation level :paramref:`.Connection.execution_options.isolation_level` - set per :class:`_engine.Connection` isolation level )rI����default_isolation_levelr����s��� rg���r����z"Connection.default_isolation_level|��s������6��|�|�3�3�3rw���c�����������������R�����t��������j������������������d|�j�������������������dndz��d���������)NzfCan't reconnect until invalid %stransaction is rolled back. Please rollback() fully before proceedingz savepoint ���8s2b)�code)r���r����rS���r����s��� rg����_invalid_transactionzConnection._invalid_transaction���s5�������&�&� ?�#�7�7�C�|�� M��� �� rw���c�����������������������|�j�������������������rS|�j������������������rG|�j�������������������|�j���������������������������|�j������������������j��������������������������|�_��������|�j������������������S�t��������j������������������d��������)N�This Connection is closed) r\���r����rQ���r����rU���rV���rN���r���r����r����s��� rg���r����z!Connection._revalidate_connection���s^���������D�$4�$4�� � �,��)�)�+�%)�[�[�%?�%?�%A�D�"��)�)�)��%�%�&A�B�Brw���c�����������������.�����|�j�������������������j������������������S�)a���Info dictionary associated with the underlying DBAPI connection referred to by this :class:`_engine.Connection`, allowing user-defined data to be associated with the connection. The data here will follow along with the DBAPI connection including after it is returned to the connection pool and used again in subsequent instances of :class:`_engine.Connection`. )rd���rp���r����s��� rg���rp���zConnection.info���s����������#�#�#rw���c�����������������������|�j�������������������ry|�j������������������rt��������j������������������d��������|�j������������������r!|�j ������������������}|�J��|j ������������������|��������d|�_��������y)a���Invalidate the underlying DBAPI connection associated with this :class:`_engine.Connection`. An attempt will be made to close the underlying DBAPI connection immediately; however if this operation fails, the error is logged but not raised. The connection is then discarded whether or not close() succeeded. Upon the next use (where "use" typically means using the :meth:`_engine.Connection.execute` method or similar), this :class:`_engine.Connection` will attempt to procure a new DBAPI connection using the services of the :class:`_pool.Pool` as a source of connectivity (e.g. a "reconnection"). If a transaction was in progress (e.g. the :meth:`_engine.Connection.begin` method has been called) when :meth:`_engine.Connection.invalidate` method is called, at the DBAPI level all state associated with this transaction is lost, as the DBAPI connection is closed. The :class:`_engine.Connection` will not allow a reconnection to proceed until the :class:`.Transaction` object is ended, by calling the :meth:`.Transaction.rollback` method; until that point, any attempt at continuing to use the :class:`_engine.Connection` will raise an :class:`~sqlalchemy.exc.InvalidRequestError`. This is to prevent applications from accidentally continuing an ongoing transactional operations despite the fact that the transaction has been lost due to an invalidation. The :meth:`_engine.Connection.invalidate` method, just like auto-invalidation, will at the connection pool level invoke the :meth:`_events.PoolEvents.invalidate` event. :param exception: an optional ``Exception`` instance that's the reason for the invalidation. is passed along to event handlers and logging functions. .. seealso:: :ref:`pool_connection_invalidation` Nr����)r����r����r���r����r����rN���� invalidate)rc���� exceptionr����s��� rg���r����zConnection.invalidate���sa������\������;�;��)�)�*E�F�F��9�9�&*�&<�&<�#�*�6�6�6�#�.�.�y�9�!%��rw���c����������������������|�j�������������������rt��������j������������������d��������|�j������������������}|�t��������j������������������d��������|j���������������������������y)a2��Detach the underlying DB-API connection from its connection pool. E.g.:: with engine.connect() as conn: conn.detach() conn.execute(text("SET search_path TO schema1, schema2")) # work with connection # connection is fully closed (since we used "with:", can # also call .close()) This :class:`_engine.Connection` instance will remain usable. When closed (or exited from a context manager context as above), the DB-API connection will be literally closed and not returned to its originating pool. This method can be used to insulate the rest of an application from a modified state on a connection (such as a transaction isolation level or similar). r����Nz&Can't detach an invalidated Connection)r����r���r����rN����InvalidRequestError�detachr����s��� rg���r����zConnection.detach���sS������4��;�;��)�)�*E�F�F�"&�"8�"8��"�*��)�)�8��� �� �&�&�(rw���c�����������������X�����|�j�������������������r|�j������������������s|�j���������������������������y�y�y�r����)r]���r[����beginr����s��� rg���� _autobeginzConnection._autobegin��s"������� � �����J�J�L��*9� rw���c�����������������|�����|�j��������������������t��������|��������|�_���������|�j�������������������S�t��������j������������������d��������)a� ��Begin a transaction prior to autobegin occurring. E.g.:: with engine.connect() as conn: with conn.begin() as trans: conn.execute(table.insert(), {"username": "sandy"}) The returned object is an instance of :class:`_engine.RootTransaction`. This object represents the "scope" of the transaction, which completes when either the :meth:`_engine.Transaction.rollback` or :meth:`_engine.Transaction.commit` method is called; the object also works as a context manager as illustrated above. The :meth:`_engine.Connection.begin` method begins a transaction that normally will be begun in any case when the connection is first used to execute a statement. The reason this method might be used would be to invoke the :meth:`_events.ConnectionEvents.begin` event at a specific time, or to organize code within the scope of a connection checkout in terms of context managed blocks, such as:: with engine.connect() as conn: with conn.begin(): conn.execute(...) conn.execute(...) with conn.begin(): conn.execute(...) conn.execute(...) The above code is not fundamentally any different in its behavior than the following code which does not use :meth:`_engine.Connection.begin`; the below style is known as "commit as you go" style:: with engine.connect() as conn: conn.execute(...) conn.execute(...) conn.commit() conn.execute(...) conn.execute(...) conn.commit() From a database point of view, the :meth:`_engine.Connection.begin` method does not emit any SQL or change the state of the underlying DBAPI connection in any way; the Python DBAPI does not have any concept of explicit transaction begin. .. seealso:: :ref:`tutorial_working_with_transactions` - in the :ref:`unified_tutorial` :meth:`_engine.Connection.begin_nested` - use a SAVEPOINT :meth:`_engine.Connection.begin_twophase` - use a two phase /XID transaction :meth:`_engine.Engine.begin` - context manager available from :class:`_engine.Engine` z�This connection has already initialized a SQLAlchemy Transaction() object via begin() or autobegin; can't call begin() here unless rollback() or commit() is called first.)rQ����RootTransactionr���r����r����s��� rg���r����zConnection.begin��sB������@����$� /�� 5�D���$�$�$��)�)�#��� rw���c�����������������P�����|�j��������������������|�j���������������������������t��������|��������S�)a���Begin a nested transaction (i.e. SAVEPOINT) and return a transaction handle that controls the scope of the SAVEPOINT. E.g.:: with engine.begin() as connection: with connection.begin_nested(): connection.execute(table.insert(), {"username": "sandy"}) The returned object is an instance of :class:`_engine.NestedTransaction`, which includes transactional methods :meth:`_engine.NestedTransaction.commit` and :meth:`_engine.NestedTransaction.rollback`; for a nested transaction, these methods correspond to the operations "RELEASE SAVEPOINT <name>" and "ROLLBACK TO SAVEPOINT <name>". The name of the savepoint is local to the :class:`_engine.NestedTransaction` object and is generated automatically. Like any other :class:`_engine.Transaction`, the :class:`_engine.NestedTransaction` may be used as a context manager as illustrated above which will "release" or "rollback" corresponding to if the operation within the block were successful or raised an exception. Nested transactions require SAVEPOINT support in the underlying database, else the behavior is undefined. SAVEPOINT is commonly used to run operations within a transaction that may fail, while continuing the outer transaction. E.g.:: from sqlalchemy import exc with engine.begin() as connection: trans = connection.begin_nested() try: connection.execute(table.insert(), {"username": "sandy"}) trans.commit() except exc.IntegrityError: # catch for duplicate username trans.rollback() # rollback to savepoint # outer transaction continues connection.execute(...) If :meth:`_engine.Connection.begin_nested` is called without first calling :meth:`_engine.Connection.begin` or :meth:`_engine.Engine.begin`, the :class:`_engine.Connection` object will "autobegin" the outer transaction first. This outer transaction may be committed using "commit-as-you-go" style, e.g.:: with engine.connect() as connection: # begin() wasn't called with connection.begin_nested(): # will auto-"begin()" first connection.execute(...) # savepoint is released connection.execute(...) # explicitly commit outer transaction connection.commit() # can continue working with connection here .. versionchanged:: 2.0 :meth:`_engine.Connection.begin_nested` will now participate in the connection "autobegin" behavior that is new as of 2.0 / "future" style connections in 1.4. .. seealso:: :meth:`_engine.Connection.begin` :ref:`session_begin_nested` - ORM support for SAVEPOINT )rQ���r�����NestedTransactionr����s��� rg����begin_nestedzConnection.begin_nestede��s&������R����$��O�O�� ��&�&rw���c����������������������|�j��������������������t��������j������������������d��������|�$|�j������������������j������������������j��������������������������}t ��������|�|�������S�)a'��Begin a two-phase or XA transaction and return a transaction handle. The returned object is an instance of :class:`.TwoPhaseTransaction`, which in addition to the methods provided by :class:`.Transaction`, also provides a :meth:`~.TwoPhaseTransaction.prepare` method. :param xid: the two phase transaction id. If not supplied, a random id will be generated. .. seealso:: :meth:`_engine.Connection.begin` :meth:`_engine.Connection.begin_twophase` zOCannot start a two phase transaction when a transaction is already in progress.)rQ���r���r����rU���rI���� create_xid�TwoPhaseTransaction)rc����xids��� rg����begin_twophasezConnection.begin_twophase���sT������(����(��)�)�*��� ���;��+�+�%�%�0�0�2�C�"�4��-�-rw���c�����������������R�����|�j�������������������r|�j�������������������j���������������������������yy)a��Commit the transaction that is currently in progress. This method commits the current transaction if one has been started. If no transaction was started, the method has no effect, assuming the connection is in a non-invalidated state. A transaction is begun on a :class:`_engine.Connection` automatically whenever a statement is first executed, or when the :meth:`_engine.Connection.begin` method is called. .. note:: The :meth:`_engine.Connection.commit` method only acts upon the primary database transaction that is linked to the :class:`_engine.Connection` object. It does not operate upon a SAVEPOINT that would have been invoked from the :meth:`_engine.Connection.begin_nested` method; for control of a SAVEPOINT, call :meth:`_engine.NestedTransaction.commit` on the :class:`_engine.NestedTransaction` that is returned by the :meth:`_engine.Connection.begin_nested` method itself. N)rQ����commitr����s��� rg���r����zConnection.commit���s$������,�������$�$�&��rw���c�����������������R�����|�j�������������������r|�j�������������������j���������������������������yy)aY��Roll back the transaction that is currently in progress. This method rolls back the current transaction if one has been started. If no transaction was started, the method has no effect. If a transaction was started and the connection is in an invalidated state, the transaction is cleared using this method. A transaction is begun on a :class:`_engine.Connection` automatically whenever a statement is first executed, or when the :meth:`_engine.Connection.begin` method is called. .. note:: The :meth:`_engine.Connection.rollback` method only acts upon the primary database transaction that is linked to the :class:`_engine.Connection` object. It does not operate upon a SAVEPOINT that would have been invoked from the :meth:`_engine.Connection.begin_nested` method; for control of a SAVEPOINT, call :meth:`_engine.NestedTransaction.rollback` on the :class:`_engine.NestedTransaction` that is returned by the :meth:`_engine.Connection.begin_nested` method itself. N)rQ����rollbackr����s��� rg���r����zConnection.rollback���s$������.�������&�&�(��rw���c�����������������L�����|�j�������������������j������������������j������������������|��������S�r����)rU���rI����do_recover_twophaser����s��� rg����recover_twophasezConnection.recover_twophase��s�������{�{�"�"�6�6�t�<�<rw���c�����������������T�����|�j�������������������j������������������j������������������|�||���������y��N)�recover)rU���rI����do_rollback_twophase�rc���r����r����s��� rg����rollback_preparedzConnection.rollback_prepared��s!�����������0�0��s�G�0�Lrw���c�����������������T�����|�j�������������������j������������������j������������������|�||���������y�r����)rU���rI����do_commit_twophaser����s��� rg����commit_preparedzConnection.commit_prepared ��s!�����������.�.�t�S�'�.�Jrw���c�����������������N�����|�j�������������������duxr�|�j�������������������j������������������S��z,Return True if a transaction is in progress.N)rQ���� is_activer����s��� rg����in_transactionzConnection.in_transaction��s$������� � ��,�L��1B�1B�1L�1L�Lrw���c�����������������N�����|�j�������������������duxr�|�j�������������������j������������������S�r����)rS���r����r����s��� rg����in_nested_transactionz Connection.in_nested_transaction��s+������� �$�$�D�0�� 3��(�(�2�2� rw���c����������������������|�j�������������������j������������������dd��������}t��������|dk(��xs)�|d�u�xr#�|�j������������������j������������������j ������������������dk(���������S�)Nr����� AUTOCOMMIT)rO���r}����boolrU���rI����_on_connect_isolation_level)rc����opt_isos��� rg����_is_autocommit_isolationz#Connection._is_autocommit_isolation��s\�������)�)�-�-�.?��F����|�#�� ��4��� ��K�K�'�'�C�C�� � �� rw���c�����������������L�����|�j�������������������}|�t��������j������������������d��������|S�)Nz"connection is not in a transaction)rQ���r���r�����rc����transs��� rg����_get_required_transactionz$Connection._get_required_transaction"��s)�������!�!���=��)�)�*N�O�O��rw���c�����������������L�����|�j�������������������}|�t��������j������������������d��������|S�)Nz)connection is not in a nested transaction)rS���r���r����r����s��� rg���� _get_required_nested_transactionz+Connection._get_required_nested_transaction(��s/�������(�(���=��)�)�;��� ���rw���c����������������������|�j�������������������S�)zaReturn the current root transaction in progress, if any. .. versionadded:: 1.4 )rQ���r����s��� rg����get_transactionzConnection.get_transaction0��s�������� � � rw���c����������������������|�j�������������������S�)zcReturn the current nested transaction in progress, if any. .. versionadded:: 1.4 )rS���r����s��� rg����get_nested_transactionz!Connection.get_nested_transaction9��s��������'�'�'rw���c����������������������|�j�������������������r3|�j��������������������������r|�j������������������d��������n|�j������������������d��������d|�_��������|�j������������������s|�j ������������������j������������������r|�j������������������j������������������|��������� �|�j ������������������j������������������j������������������|�j��������������������������d|�_��������y�#�t��������$�r}|�j������������������|d�d�d�d���������Y�d�}~�+d�}~ww�xY�w#�d|�_��������w�xY�w)Nz?BEGIN (implicit; DBAPI should not BEGIN due to autocommit mode)zBEGIN (implicit)TF) r_���r����rv���r[���ra���rU���rK���r����rI����do_beginrd���r����r�����rc����transactionr����s��� rg����_begin_implzConnection._begin_implA��s��������:�:��,�,�.����'�� ����1�2�������t�{�{�6�6��M�M����%� $��K�K���(�(����9��$�D�O����� D��(�(��D�$��d�C�C�� D���$�D�O�s*����/B<��< C$�C�C'��C$�$C'��' C0c����������������������|�j�������������������s|�j������������������j�������������������r|�j������������������j������������������|���������|�j������������������rp|�j ������������������r3|�j ��������������������������r|�j������������������d��������n|�j������������������d�������� �|�j������������������j������������������j������������������|�j��������������������������y�y�#�t��������$�r}|�j������������������|d�d�d�d���������Y�d�}~y�d�}~ww�xY�w)NzVROLLBACK using DBAPI connection.rollback(), DBAPI should ignore due to autocommit mode�ROLLBACK) ra���rU���rK���r����r����r_���r����rv���rI����do_rollbackrd���r����r����r����s��� rg����_rollback_implzConnection._rollback_implW��s����������t�{�{�6�6��M�M�"�"�4�(��9�9��z�z��0�0�2��N�N�E�� ��N�N�:�.� H����#�#�/�/����@��:���!�� H��,�,�Q��d�D�$�G�G�� H�s���� /B;��; C#�C�C#c���������������������|�j�������������������s|�j������������������j�������������������r|�j������������������j������������������|���������|�j������������������r3|�j��������������������������r|�j ������������������d��������n|�j ������������������d�������� �|�j������������������j������������������j������������������|�j��������������������������y�#�t��������$�r}|�j������������������|d�d�d�d���������Y�d�}~y�d�}~ww�xY�w)NzRCOMMIT using DBAPI connection.commit(), DBAPI should ignore due to autocommit mode�COMMIT)ra���rU���rK���r����r_���r����rv���rI���� do_commitrd���r����r����r����s��� rg����_commit_implzConnection._commit_impli��s����������t�{�{�6�6��M�M� � ��&��:�:��,�,�.����A�� ����x�(� D��K�K���)�)�$�/�/�:���� D��(�(��D�$��d�C�C�� D�s����>/B.��. C�7C�Cc���������������������|�j�������������������s|�j������������������j�������������������r|�j������������������j������������������|�|��������|�$|�xj������������������dz ��c_��������d|�j������������������z��}|�j������������������j ������������������j ������������������|�|��������|S�)Nr���zsa_savepoint_%s)ra���rU���rK���� savepointrZ���rI����do_savepoint�rc���r����s��� rg����_savepoint_implzConnection._savepoint_implz��sp���������t�{�{�6�6��M�M�#�#�D�$�/��<�� � �A�%� �$�t�';�';�;�D������(�(��t�4��rw���c�����������������������|�j�������������������s|�j������������������j�������������������r|�j������������������j������������������|�|d���������|�j������������������r'|�j������������������j ������������������j ������������������|�|��������y�y�r����)ra���rU���rK����rollback_savepointr����rI����do_rollback_to_savepointr ��s��� rg����_rollback_to_savepoint_implz&Connection._rollback_to_savepoint_impl���sU���������t�{�{�6�6��M�M�,�,�T�4��>��9�9��K�K���8�8��t�D��:rw���c�����������������������|�j�������������������s|�j������������������j�������������������r|�j������������������j������������������|�|d���������|�j������������������j������������������j������������������|�|��������y�r����)ra���rU���rK����release_savepointrI����do_release_savepointr ��s��� rg����_release_savepoint_implz"Connection._release_savepoint_impl���sG���������t�{�{�6�6��M�M�+�+�D�$��=������0�0��t�<rw���c���������������������|�j�������������������r|�j������������������d��������|�j������������������s|�j������������������j������������������r&|�j������������������j������������������|�|j��������������������������d|�_�������� �|�j������������������j������������������j������������������|�|j��������������������������d|�_��������y�#�t��������$�r}|�j������������������|d�d�d�d���������Y�d�}~�+d�}~ww�xY�w#�d|�_��������w�xY�w)NzBEGIN TWOPHASE (implicit)TF)r_���rv���ra���rU���rK���r����r����r[���rI����do_begin_twophaser����r����r����s��� rg����_begin_twophase_implzConnection._begin_twophase_impl���s��������:�:��N�N�6�7����t�{�{�6�6��M�M�(�(��{���?���� $��K�K���1�1�$����H��$�D�O����� D��(�(��D�$��d�C�C�� D���$�D�O�s*����.0B&��& C�/C �C�� C�C�� Cc�����������������\����|�j�������������������s|�j������������������j�������������������r|�j������������������j������������������|�|��������t ��������|�j ������������������t���������������sJ�� �|�j������������������j������������������j������������������|�|��������y�#�t��������$�r}|�j������������������|d�d�d�d���������Y�d�}~y�d�}~ww�xY�wr����)ra���rU���rK����prepare_twophase� isinstancerQ���r����rI����do_prepare_twophaser����r����)rc���r����r����s��� rg����_prepare_twophase_implz!Connection._prepare_twophase_impl���s����������t�{�{�6�6��M�M�*�*�4��5��$�+�+�-@�A�A�A� D��K�K���3�3�D�#�>���� D��(�(��D�$��d�C�C�� D�s����&B�� B+�B&�&B+c�����������������z����|�j�������������������s|�j������������������j�������������������r|�j������������������j������������������|�||��������|�j������������������rEt��������|�j������������������t���������������sJ�� �|�j������������������j������������������j������������������|�||��������y�y�#�t��������$�r}|�j������������������|d�d�d�d���������Y�d�}~y�d�}~ww�xY�wr����)ra���rU���rK����rollback_twophaser����r��rQ���r����rI���r����r����r�����rc���r�����is_preparedr����s��� rg����_rollback_twophase_implz"Connection._rollback_twophase_impl���s����������t�{�{�6�6��M�M�+�+�D�#�{�C��9�9��d�/�/�1D�E�E�E� H����#�#�8�8��#�{���:���!�� H��,�,�Q��d�D�$�G�G�� H�s����)'B�� B:�B5�5B:c�����������������`����|�j�������������������s|�j������������������j�������������������r|�j������������������j������������������|�||��������t ��������|�j ������������������t���������������sJ�� �|�j������������������j������������������j������������������|�||��������y�#�t��������$�r}|�j������������������|d�d�d�d���������Y�d�}~y�d�}~ww�xY�wr����)ra���rU���rK����commit_twophaser��rQ���r����rI���r����r����r����r!��s��� rg����_commit_twophase_implz Connection._commit_twophase_impl���s����������t�{�{�6�6��M�M�)�)�$��[�A��$�+�+�-@�A�A�A� D��K�K���2�2�4��k�J���� D��(�(��D�$��d�C�C�� D�s����'B�� B-�B(�(B-c���������������������|�j�������������������r|�j�������������������j���������������������������d}nd}|�j�������������������B|�j������������������}|rt��������d|�������j ������������������d���������n|j���������������������������d|�_��������d|�_��������y)a���Close this :class:`_engine.Connection`. This results in a release of the underlying database resources, that is, the DBAPI connection referenced internally. The DBAPI connection is typically restored back to the connection-holding :class:`_pool.Pool` referenced by the :class:`_engine.Engine` that produced this :class:`_engine.Connection`. Any transactional state present on the DBAPI connection is also unconditionally released via the DBAPI connection's ``rollback()`` method, regardless of any :class:`.Transaction` object that may be outstanding with regards to this :class:`_engine.Connection`. This has the effect of also calling :meth:`_engine.Connection.rollback` if any transaction is in place. After :meth:`_engine.Connection.close` is called, the :class:`_engine.Connection` is permanently in a closed state, and will allow no further operations. TFNr5���)�transaction_reset)rQ���r����rN���r����_close_specialr\���)rc���� skip_reset�conns��� rg���r����zConnection.close���s�������.�������#�#�%��J��J��!�!�-��)�)�D����'��.�=�=�&*��>����� � ���&*�D�"�$��rw����r����c����������������������y�r����r�����rc���� statement� parametersr����s��� rg����scalarzConnection.scalar���s�������rw���c����������������������y�r����r����r.��s��� rg���r1��zConnection.scalar���s�������rw���c���������������������t��������|�������} �|j������������������}�||�||xs�t���������������S�#�t��������$�r}t ��������j ������������������|�������|�d}~ww�xY�w)au��Executes a SQL statement construct and returns a scalar object. This method is shorthand for invoking the :meth:`_engine.Result.scalar` method after invoking the :meth:`_engine.Connection.execute` method. Parameters are equivalent. :return: a scalar Python value representing the first column of the first row returned. N)r����_execute_on_scalarrF����AttributeErrorr����ObjectNotExecutableError�rc���r/��r0��r�����distilled_parameters�methrf���s��� rg���r1��zConnection.scalar��sc������"� 2�*�=�� ��/�/�D����$�!�/�Z��� ����� C��.�.�y�9�s�B�� C������+�� A�A � Ac����������������������y�r����r����r.��s��� rg����scalarszConnection.scalars����������rw���c����������������������y�r����r����r.��s��� rg���r<��zConnection.scalars(���������� rw���c����������������F�����|�j������������������|||��������j��������������������������S�)a���Executes and returns a scalar result set, which yields scalar values from the first column of each row. This method is equivalent to calling :meth:`_engine.Connection.execute` to receive a :class:`_result.Result` object, then invoking the :meth:`_result.Result.scalars` method to produce a :class:`_result.ScalarResult` instance. :return: a :class:`_result.ScalarResult` .. versionadded:: 1.4.24 r,��)�executer<��r.��s��� rg���r<��zConnection.scalars1��s)������*��|�|��z�5F���� � �'�)� rw���c����������������������y�r����r����r.��s��� rg���rA��zConnection.executeJ��r=��rw���c����������������������y�r����r����r.��s��� rg���rA��zConnection.executeS��r?��rw���c���������������������t��������|�������} �|j������������������}�||�||xs�t���������������S�#�t��������$�r}t ��������j ������������������|�������|�d}~ww�xY�w)a���Executes a SQL statement construct and returns a :class:`_engine.CursorResult`. :param statement: The statement to be executed. This is always an object that is in both the :class:`_expression.ClauseElement` and :class:`_expression.Executable` hierarchies, including: * :class:`_expression.Select` * :class:`_expression.Insert`, :class:`_expression.Update`, :class:`_expression.Delete` * :class:`_expression.TextClause` and :class:`_expression.TextualSelect` * :class:`_schema.DDL` and objects which inherit from :class:`_schema.ExecutableDDLElement` :param parameters: parameters which will be bound into the statement. This may be either a dictionary of parameter names to values, or a mutable sequence (e.g. a list) of dictionaries. When a list of dictionaries is passed, the underlying statement execution will make use of the DBAPI ``cursor.executemany()`` method. When a single dictionary is passed, the DBAPI ``cursor.execute()`` method will be used. :param execution_options: optional dictionary of execution options, which will be associated with the statement execution. This dictionary can provide a subset of the options that are accepted by :meth:`_engine.Connection.execution_options`. :return: a :class:`_engine.Result` object. N)r����_execute_on_connectionrF���r5��r���r6��r7��s��� rg���rA��zConnection.execute\��sd������L� 2�*�=�� ��3�3�D����$�!�/�Z��� ����� C��.�.�y�9�s�B�� C�r:��c�����������������D�����|�j������������������|j��������������������������||�������S�)z%Execute a sql.FunctionElement object.)�_execute_clauseelement�select)rc����funcr8��r����s��� rg����_execute_functionzConnection._execute_function���s&��������*�*��K�K�M�/�1B� �� rw���c���������������������|�j�������������������j������������������|�������}|�j������������������s|�j������������������j������������������r|�j ������������������|||�������\��}}}}ndx}} �|�j ������������������}|�|�j ��������������������������}|�j������������������}|j������������������j������������������||�||�������}j������������������d|d�������} |�j������������������s|�j������������������j������������������r |�j ������������������j#������������������|�||||| ��������| S�#�t��������j������������������t��������j������������������f$�r���t��������$�r} |�j������������������| dddd��������Y�d} ~ ��d} ~ ww�xY�w)z&Execute a schema.ColumnDefault object.N)rO���� merge_withra���rU����_invoke_before_exec_eventrN���r����rI����execution_ctx_cls� _init_defaultr���r����r����r����r����� _exec_defaultrK���� after_execute)rc����defaultr8��r�����event_multiparams�event_paramsr+��rI����ctxr�����rets��� rg����_execute_defaultzConnection._execute_default���sX������!�3�3�>�>�� ������t�{�{�6�6���.�.��-�/@�� ��$�!�� �04�3��� D��)�)�D��|��2�2�4���l�l�G��+�+�9�9���t�%6��C������g�t�4�����t�{�{�6�6��M�M�'�'���!��!�� ��� ��#��(�(�#�*A�*A�B�� ���� D��(�(��D�$��d�C�C�� D�s����AC;��;,E�'E�Ec����������������� ����|j�������������������j������������������|�j�������������������|�������}|�j������������������s|�j������������������j������������������r|�j ������������������|||�������\��}}}}ndx}}|j������������������dd�������}|�j������������������}|j������������������||��������} |�j������������������||j������������������j������������������| d|| �������} |�j������������������s|�j������������������j������������������r |�j������������������j������������������|�||||| ��������| S�)zExecute a schema.DDL object.Nr|���)rI���r|���) rO���rL��ra���rU���rM��r}���rI����compile�_execute_contextrN��� _init_ddlrK���rQ��)rc����ddlr8��r����� exec_optsrS��rT��r|���rI����compiledrV��s��� rg����_execute_ddlzConnection._execute_ddl���s�������*�*�5�5��#�#�%6� � �����t�{�{�6�6���.�.��)�9�� ��$�!�� �04�3���(�}�}�-C�T�J���,�,���;�;��2F���� ����#�#���%�%�/�/����� ������t�{�{�6�6��M�M�'�'���!���� ��� rw���c�����������������������t��������|�������dk(��rg�|d���}}n|i�}}|�j������������������j������������������D�]��}�||�||||�������\��}}}��|r"t��������|�������}|rt ��������j ������������������d��������|r|g}ng�}||||fS�)Nr���r���zLEvent handler can't return non-empty multiparams and params at the same time)�lenrK����before_execute�listr���r����)rc����elem�distilled_paramsr����rS��rT���fns��� rg���rM��z$Connection._invoke_before_exec_event ��s���������� �A�%�.0�2B�1�2E�|��.>��|���-�-�.�.�B�46���!��!�5�1�D�#�\��/���#�$5�6����-�-�2������ ,�~��!���%�'8�,�F�Frw���c���������������������|j�������������������j������������������|�j�������������������|�������}|�j������������������xs�|�j������������������j������������������}|r|�j ������������������|||�������\��}}}}|rt��������|d����������}t ��������|�������dkD��}ng�}d}|�j������������������} |j������������������dd�������} |j������������������d|�j������������������j�������������������������}|j������������������| |||| |�j������������������j������������������t��������j������������������z����������\��}} }|�j������������������| | j������������������j ������������������||||||| |�� ������}|r |�j"������������������j%������������������|�|||��������|S�) z#Execute a sql.ClauseElement object.r���r���Fr|���Nr����)rI���r�����column_keys�for_executemanyr|����linting)� cache_hit)rO���rL��ra���rU���rM���sortedra��rI���r}����_compiled_cache�_compile_w_cache�compiler_lintingr"����WARN_LINTINGrZ��rN���_init_compiledrK���rQ��)rc���rd��r8��r����� has_eventsrS��rT���keysri��rI���r|���r�����compiled_sql�extracted_paramsrk��rV��s��� rg���rG��z!Connection._execute_clauseelement4��s�������!�3�3�>�>��#�#�%6� ����%�%�@����)@�)@� ����.�.��*�,=�� ��$�!�� � ���.�q�1�2�D�!�"6�7�!�;�O��D�#�O��,�,��0�4�4�"�D� ���7H�6K�6K��d�k�k�9�9�7 ���59�4I�4I��)��+�!5��L�L�1�1�H�4I�4I�I� �5J��5 �1��&� ���#�#���%�%�4�4�� ��� �����$�� �����M�M�'�'���!��!�� ��� rw���c���������������������|j�������������������j������������������|�j������������������|�������}|�j������������������s|�j������������������j������������������r|�j������������������|||�������\��}}}}|�j������������������}|�j������������������||j������������������j������������������|||||dd� ������}|�j������������������s|�j������������������j������������������r |�j������������������j������������������|�|||��������|S�)ziExecute a sql.Compiled object. TODO: why do we have this? likely deprecate or remove N)r����rL��rO���ra���rU���rM��rI���rZ��rN��rq��rK���rQ��)rc���r^��r8��r����rS��rT��rI���rV��s��� rg����_execute_compiledzConnection._execute_compiled}��s��������%�6�6�A�A��#�#�%6� ������t�{�{�6�6���.�.��.�0A�� ��$�!�� ��,�,���#�#���%�%�4�4�� ��� ��� ������t�{�{�6�6��M�M�'�'���!��!�� ��� rw���c����������� �����������t��������|�������}|�j������������������j������������������|�������}|�j������������������}|�j ������������������||j ������������������j������������������|d|||�������}|S�)aL��Executes a string SQL statement on the DBAPI cursor directly, without any SQL compilation steps. This can be used to pass any string directly to the ``cursor.execute()`` method of the DBAPI in use. :param statement: The statement str to be executed. Bound parameters must use the underlying DBAPI's paramstyle, such as "qmark", "pyformat", "format", etc. :param parameters: represent bound parameter values to be used in the execution. The format is one of: a dictionary of named parameters, a tuple of positional parameters, or a list containing either dictionaries or tuples for multiple-execute support. :return: a :class:`_engine.CursorResult`. E.g. multiple dictionaries:: conn.exec_driver_sql( "INSERT INTO table (id, value) VALUES (%(id)s, %(value)s)", [{"id": 1, "value": "v1"}, {"id": 2, "value": "v2"}], ) Single dictionary:: conn.exec_driver_sql( "INSERT INTO table (id, value) VALUES (%(id)s, %(value)s)", dict(id=1, value="v1"), ) Single tuple:: conn.exec_driver_sql( "INSERT INTO table (id, value) VALUES (?, ?)", (1, "v1") ) .. note:: The :meth:`_engine.Connection.exec_driver_sql` method does not participate in the :meth:`_events.ConnectionEvents.before_execute` and :meth:`_events.ConnectionEvents.after_execute` events. To intercept calls to :meth:`_engine.Connection.exec_driver_sql`, use :meth:`_events.ConnectionEvents.before_cursor_execute` and :meth:`_events.ConnectionEvents.after_cursor_execute`. .. seealso:: :pep:`249` N)r���rO���rL��rI���rZ��rN���_init_statement)rc���r/��r0��r����r8��rI���rV��s��� rg����exec_driver_sqlzConnection.exec_driver_sql���sm������t� 3�:�>�� �3�3�>�>�� ����,�,���#�#���%�%�5�5����� � ���� rw���c�����������������*����|r(|j������������������dd�������}|r|j������������������d|d��������} �|�j������������������} | �|�j��������������������������} �|||�| |g|��i�|��} |�j������������������r|�j������������������j������������������r"|�j������������������r'|�j������������������j������������������s|�j���������������������������n!|�j������������������rt��������j ������������������|���������|�j�������������������|�j#��������������������������� j%���������������������������| j&������������������t(��������j*������������������u�r|�j-������������������|| �������S�|�j/������������������|| ||�������S�#�t��������j ������������������t��������j������������������f$�r���t��������$�r)}|�j������������������|t��������|�������|dd��������Y�d}~��4d}~ww�xY�w)zdCreate an :class:`.ExecutionContext` and execute, returning a :class:`_engine.CursorResult`.r����NT)r����r����)r}���r����rN���r����r���r����r����r����r�����strrQ���r����rS���r����rL���r����_trans_ctx_checkr�����pre_exec� execute_styler����INSERTMANYVALUES�_exec_insertmany_context�_exec_single_context)rc���rI����constructorr/��r0��r�����argsrt����ypr+���contextr����s��� rg���rZ��zConnection._execute_context���s��������"�&�&�{�D�9�B��$5�$;�$;�'+�r�B�%�!� ��)�)�D��|��2�2�4��!���t�%6��9=��AC��G�� ����%�%�/�/��(�(��0�0�:�:�� �%�%�'� � (� (� �1�1�$�7����$��O�O������� � �L�$A�$A�A��0�0��'�B�B��,�,���)�Z��� ��9��(�(�#�*A�*A�B�� ���� ��(�(��3�y�>�:�t�T� �� �� �s����-D=��=,F�)F � Fc����������� ������p����|j�������������������t��������j������������������u�r0|j��������������������������}|r �|j ������������������|j ������������������||��������|j ������������������|j������������������|j������������������}}}|j������������������s|d���} n|} |�j������������������s|�j������������������j������������������r5|�j������������������j������������������D�]��} �| |�||| ||j�������������������������\��}} ��|�j ������������������r}|�j#������������������|��������|j%��������������������������}|�j������������������j&������������������s4|�j#������������������d|t)��������j*������������������| d|j����������������������������������n|�j#������������������d|��������d} �|j,������������������t.��������j0������������������u�rxt3��������d| �������} |�j4������������������j������������������r4|�j4������������������j������������������j6������������������D�]��} �| ||| |�������s�d }�n�|�s|�j4������������������j7������������������||| |��������n�| su|j8������������������ri|�j4������������������j������������������r3|�j4������������������j������������������j:������������������D�]��} �| |||�������s�d }�n�|s�|�j4������������������j;������������������|||��������nvt3��������d | �������} |�j4������������������j������������������r4|�j4������������������j������������������j<������������������D�]��} �| ||| |�������s�d }�n�|s|�j4������������������j=������������������||| |��������|�j������������������s|�j������������������j������������������r*|�j������������������j?������������������|�||| ||j��������������������������|jA���������������������������|jC��������������������������} | S�#�t��������$�r)}|�j������������������|t��������|�������|d|��������Y�d}~��7d}~ww�xY�w#�t��������$�r }|�j������������������||| ||��������Y�d}~ S�d}~ww�xY�w)zzcontinue the _execute_context() method for a single DBAPI cursor.execute() or cursor.executemany() call. Nr����[%s] %r� �����batches�ismulti�8[%s] [SQL parameters hidden due to hide_parameters=True]Fr(���Tr)���)"�bind_typingr���� SETINPUTSIZES�_prepare_set_input_sizes�do_set_input_sizes�cursorr����r����r|��r/��r0���executemanyra���rU���rK����before_cursor_executer_���rv����_get_cache_stats�hide_parameters�sql_util�_repr_paramsr��r����EXECUTEMANYr���rI����do_executemanyr�����do_execute_no_params� do_execute�after_cursor_execute� post_exec�_setup_result_proxy)rc���rI���r���r/��r0���generic_setinputsizesr����r���� str_statement�effective_parametersrf���stats�evt_handled�results��� rg���r���zConnection._exec_single_context7��s����������*�":�":�:�$+�$D�$D�$F�!�$���.�.����(=�w��� �N�N�������� *� ����"�"�#-�a�=� �#-� ����t�{�{�6�6��m�m�9�9��68���!�(���'�'� 7�3� �3��:���:�:��N�N�=�)��,�,�.�E��;�;�.�.�������)�)�,� "� '� 3� 3�������N��� �"��D ��$�$��(@�(@�@�'+�-�/C�(�$���<�<�+�+�"�l�l�3�3�B�B���"�)�0�#� ��+/�K�!��C��#��L�L�/�/��%�,�� ��*�g�.C�.C��<�<�+�+�"�l�l�3�3�H�H���f�m�W�=�*.�K�!��I��#��L�L�5�5�� �w���(,�.�0D�(�$���<�<�+�+�"�l�l�3�3�>�>���"�)�0�#� ��+/�K�!��?��#��L�L�+�+�� �/C�W������4�;�;�#:�#:�� � �2�2���!�(���'�'� �� �����0�0�2�F��� ��s�%����0�0��3�y�>�:�t�W�������h��� ��(�(��=�"6��� �� ��� �� �sE����M��(A,N��A8N��A5N��BN�� N � N�N � N5�N0�0N5c����������� ������j����|j�������������������t��������j������������������u�r|j��������������������������}nd}|j������������������|j ������������������|j������������������}}}|}|�j������������������xs�|�j������������������j������������������}|�j������������������j������������������r!|�j������������������j������������������j������������������} nd} |�j������������������r|j��������������������������dz���} |j������������������j������������������dd�������}d}|j!������������������|�|||||�������D��]���} | j"������������������r( �|j%������������������|j������������������| j"������������������|��������| j.������������������}| j0������������������}|r+|�j������������������j2������������������D�]��}�||�||||d�������\��}}��|�j������������������r�|�j5������������������t+��������j,������������������|���������������d | j6��������������������d | j8��������������������d| j:������������������rdnd ��| j<������������������rdnd��d�}| j6������������������dk(��r |z ��} nd|���} |�j������������������j>������������������s*|�j5������������������d| t+��������j@������������������|dd����������������n|�j5������������������d| �������� �| D�]��}�|||||�������s��n�|j������������������||||��������|r*|�j������������������jC������������������|�|||||jD��������������������������|s���|| jF������������������z ��}���� �|jI���������������������������|r||_%��������|jM��������������������������}|S�#�t&��������$�rI}|�j)������������������|t+��������j,������������������| j.�������������������������| j0������������������d|d���������Y�d}~��d}~ww�xY�w#�t&��������$�r4}|�j)������������������|t+��������j,������������������|�������|||d���������Y�d}~��d}~ww�xY�w#�t&��������$�r }|�j)������������������|||||��������Y�d}~S�d}~ww�xY�w)z�continue the _execute_context() method for an "insertmanyvalues" operation, which will invoke DBAPI cursor.execute() one or more times with individual log and event hook calls. Nr����z (insertmanyvalues)r����Fr���T)�is_sub_exec� �/z (�ordered� unorderedz; batch not supportedr�����)r����insertmanyvaluesr���r���r���r���)'r���r���r���r���r���r/��r0��ra���rU���rI���rK���r���r_���r���r����r}����!_deliver_insertmanyvalues_batches�processed_setinputsizesr���r����r����r����_long_statement�replaced_statement�replaced_parametersr���rv����batchnum� total_batches�rows_sorted� is_downgradedr���r���r���r����current_batch_sizer���� _rowcountr���)rc���rI���r���r���r���r���r0��r���� engine_events�do_execute_dispatchr���r�����rowcount� imv_batchr�����sub_stmt� sub_paramsrf��� imv_statsr���s��� rg���r���z#Connection._exec_insertmany_context���s����������*�":�":�:�$+�$D�$D�$F�!�$(�!�� �N�N�������� *� ��� *���(�(�C�D�K�K�,C�,C� ��<�<�#�#����%�%�0�0�� ��#%���:�:��,�,�.�1F�F�E�#�5�5�9�9��� ����� �B�B���� �!�� �I���0�0���.�.����!�9�9����!�3�3�H�"�6�6�J���-�-�=�=�B�+-��� �"��� ,�(�H�j��>���z�z����x�7�7��A�B� !�)�"4�"4�!5�Q�%�3�3�7�� �,�,���2=�� �!�.�.��,����� � ���%�%��*��Y�&�E�.�y�k�:�E��{�{�2�2��N�N�!�� �-�-�&�$&�$)�����N�N�0��� �-�B��� �"�� ����.���&�&�� �"�� �"��� � �2�2���!�(���'�'� ��!��I�8�8�8��c �f ����� �$,��!��0�0�2�F��� ��c�%����0�0�� �0�0��1M�1M�N�!�5�5���$(� �1��������Z�!�� ��,�,���,�,�X�6���� $� �-������ ��>��� ��(�(��=�"6��� �� ��� �� �sN����'K4�M �/M � )N ��4 M�=>M�M� N�*N�N� N2�N-�-N2c����������� ����������|�j�������������������s|�j������������������j�������������������r+|�j������������������j������������������D�]��}�||�||||d�������\��}}��|�j������������������r#|�j������������������|��������|�j������������������d|�������� �|�j������������������j�������������������sdn|�j������������������j������������������j������������������D�]��}�|||||�������s��n�|�j������������������j������������������||||��������|�j�������������������s|�j������������������j�������������������r!|�j������������������j������������������|�||||d��������yy#�t��������$�r}|�j������������������|||||��������Y�d}~�gd}~ww�xY�w)a_��Execute a statement + params on the given cursor. Adds appropriate logging and exception handling. This method is used by DefaultDialect for special-case executions, such as for sequences and column defaults. The path of statement execution in the majority of cases terminates at _execute_context(). Fz[raw sql] %rr����N)ra���rU���rK���r���r_���rv���rI���r���r����r����r���)rc���r���r/��r0��r���rf��r����s��� rg����_cursor_executezConnection._cursor_executep��s?�����"����t�{�{�6�6��m�m�9�9��(*��&�)�Z��%�)�%� �:��:� ��:�:��N�N�9�%��N�N�>�:�6� ���|�|�/�/����\�\�*�*�5�5�6��� ��f�i��W�=��6�����'�'�� �:�w�O�����t�{�{�6�6��M�M�.�.��f�i��W�e� �� 7����� ��(�(��9�j�&�'� �� �� �s����>AD*��!D*��* E�3E � Ec���������������������� �|j���������������������������y#�t��������$�r4�|�j������������������j������������������j������������������j������������������dd���������Y�yw�xY�w)z\Close the given cursor, catching exceptions and turning into log warnings. zError closing cursorT)�exc_infoN)r����� ExceptionrU����poolro����error)rc���r���s��� rg����_safe_close_cursorzConnection._safe_close_cursor���sG������ ��L�L�N���� ��K�K���#�#�)�)�&��� *�� � �s������:A�Ac�����������������Z����t��������j��������������������������}t��������j������������������|�������}|�j������������������s�t��������||�j������������������j������������������j�������������������������xrD�|�j�������������������xr5�|�j������������������j������������������||�j������������������s|�j������������������nd�|�������xs�|xr �|�j�������������������|�_��������|�} |�|�xr�|j������������������nd} |�j������������������rut��������j ������������������j#������������������||||�j������������������j������������������j������������������|�j$������������������j&������������������|�j������������������| ��������j)������������������|d����������|�d|�_�������� �t��������||�j������������������j������������������j�������������������������xs�|d�uxr �|d�u�xr�|�}|r|t��������j ������������������j#������������������||t+��������t,��������|�������|�j������������������j������������������j������������������|�j$������������������j&������������������|�j������������������|�j������������������| ��������}nd�}d�} |�j������������������j.������������������r�|�j0������������������j3������������������dd�������s�t5��������|||�j$������������������|�j������������������|�|||||�j������������������| d�������}|�j������������������j6������������������j8������������������D�]��} ��||�������}|� |x|_��������} ��|�j������������������|j������������������k7��r$|j������������������|�_��������|r|j������������������|_��������|j>������������������} |r|r|jA������������������|��������|�j������������������s3|r|�jC������������������|��������|�jE��������������������������s|�jG���������������������������| r| j)������������������|d����������|�|r|�J��|j)������������������|d����������|�|d����J��|d���j)������������������|d�����������#�t,��������$�r }|} Y�d�}~���d�}~ww�xY�w#�|�`|�j������������������rY|�`|�j������������������sJ|�j������������������}|�J��| r&|�j$������������������jH������������������jK������������������||��������|�jM������������������|��������w�w�w�xY�w)NF)r���rI���r���r���T)r����connection_invalidatedrI���r����skip_user_error_eventsr���)'�sysr���r!����is_exit_exception�_is_disconnectr��rI���rW���rX���r����� is_disconnectr����rN���r����_reentrant_errorr���� DBAPIError�instancerU���r����with_tracebackr���r���ra���rO���r}����ExceptionContextImplrK����handle_error�chained_exceptionr����invalidate_pool_on_disconnect�handle_dbapi_exceptionr���r����r��r����_invalidater����)rc���r����r/��r0��r���r���r���r���r���r���r����should_wrap�sqlalchemy_exception�newraiserU��rf���per_fn�_raised�dbapi_conn_wrappers��� rg���r����z"Connection._handle_dbapi_exception���s!�������<�<�>�� �2�2�1�5���"�"��1�d�l�l�7�7�=�=�>������O���L�L�.�.��26�2B�2B�D�*�*����#9��$�7�D�K�K��� ���->�(=�%���"���O�3�� 3� 3��� � �� � ��.�.�)�)�������)�)�/�/� $��� ;� ;������*�����n�X�a�[�)�q� 1��!%���e '��%�Q����(A�(A�(G�(G�H�����%��*��t�O�*�)�)�� ���'*�~�~�'>�'>�����A�&��L�L�-�-�3�3�$(�K�K�$?�$?�+/�+>�+>� �L�L�#��(?�� (�$��(,�$��H����(�(�$�2I�2I�2M�2M�(�%�3��+��(��K�K��L�L�������'�'�1�� ����,�,�/�/�<�<�B� ��"$�C���!�-�?E�E�C�1�H�� �=���&�&�#�*;�*;�;�*-�*;�*;�D�'�+��-�-��-�C���5�5��.���w��.�.�q�1��&�&���+�+�F�3���*�*�,��'�'�)���-�-�h�q�k�:��A��+�7�7�7�*�9�9�(�1�+�F�A�M���{�.�.�.��q�k�0�0��!��=�=��S�%���#*������V��%��"�"��'��'�'�)-�)?�)?�&�-�9�9�9�4����(�(�4�4�5G��K��O�O�A�&��(��#�s9����EO��&N(�9C/O��( N>�1N9�3O��9N>�>O��A)P*c�����������������N����t��������j��������������������������}|�5t��������||j������������������j�������������������������xr�|j������������������|d�d��������}t��������||j������������������j�������������������������}|rWt��������j������������������j������������������d�d�t��������t��������|�������|j������������������j������������������|�|j������������������nd||��������} nd�} d�} |j������������������rit��������|| ||d�d�d�d�d�|||�������}|j������������������j������������������D�]��} ��||�������} | � | x|_��������} ��| r"||j ������������������k7��r|j ������������������x| _��������}| r| j%������������������|d����������|�|r| �J��| j%������������������|d����������|�|d����J��|d���j%������������������|d�����������#�t��������$�r }|} Y�d�}~���d�}~ww�xY�w)NF)r���r���rI���r���r���)r���r���r��rW���rX���r���r���r���r���r���r���r���ra���r���rK���r���r���r���r���)�clsr����rI���rU���r���r����is_pre_pingr���r���r���r���rU��rf��r���r���s��� rg���rY���z/Connection._handle_dbapi_exception_noconnection? ��s��������<�<�>��� �&��7�'�'�-�-���7��'�'��4��6�� ��!��G�$8�$8�$>�$>�?���#&�>�>�#:�#:����Y��"��$�$�*�*�.4�.@�F�*�*�e�'4���$;�� $� ��$(� ������&��$���������-�� �C���&�&�3�3�� �� ��W�F��)�;A�A��-��� �4��$� ��9J�9J�(J��%�%��$�;�m����)�)�(�1�+�6�A�=� �'�3�3�3�&�5�5�h�q�k�B��I��A�;�*�*�*��1�+�,�,�X�a�[�9�9��#�!���&�H����s����F� F$�F�F$c�����������������J������||�j�������������������|�fi�|��j������������������|��������y)z�run a DDL visitor. This method is only here so that the MockConnection can change the options given to the visitor so that "checkfirst" is skipped. N)rI����traverse_single)rc����visitorcallable�element�kwargss��� rg����_run_ddl_visitorzConnection._run_ddl_visitor� ��s"������� ����d�5�f�5�E�E�g�Nrw���)NNTT) rU����Enginerd���rM���ra����Optional[bool]re���r����r]���r����)rr���r|��rs���r���rt���r����return�None)r���� Optional[SchemaTranslateMapType])r����r@���r���� Optional[str]�r���rH���)r����r���r����r���r����r���r���r���)r�����Optional[CompiledCacheType]r����r|��r����r���r����r����r����r����r�����intr����r���r����r���r|���r���r����r����r����r���r���rH���)r����r���r���rH����r���r,����r���r�����r���r7���)r���r���)r���zOptional[IsolationLevel])r���r���)r���r9���r����)r����zOptional[BaseException]r���r����r���r���)r���r����)r���r����)r����z Optional[Any]r���r����)r���z List[Any]�F)r����r���r����r����r���r���)r���rP���)r���rR���)r���r����r���r���)r����r���r���r|��)r����r|��r���r���)r���r����r���r���)r����r���r���r���)r����r���r"��r����r���r���)r/���TypedReturnsRows[Tuple[_T]]r0���"Optional[_CoreSingleExecuteParams]r�����%Optional[CoreExecuteOptionsParameter]r���zOptional[_T])r/��r8���r0��r���r����r���r���r���)r/��r���r0���Optional[_CoreAnyExecuteParams]r����r���r���zScalarResult[_T])r/��r8���r0��r���r����r���r���zScalarResult[Any])r/��zTypedReturnsRows[_T]r0��r���r����r���r���zCursorResult[_T])r/��r8���r0��r���r����r���r����CursorResult[Any])rI��zFunctionElement[Any]r8��r(���r����r.���r���r���)rR��r?���r8��r(���r����r.���r���r���)r\��r;���r8��r(���r����r.���r���r���)rd��r���re��r(���r����r,���r���zVTuple[Any, _CoreMultiExecuteParams, _CoreMultiExecuteParams, _CoreSingleExecuteParams])rd��r8���r8��r(���r����r.���r���r���)r^��r:���r8��r(���r����r.���r���r���)NN)r/��r|��r0��� Optional[_DBAPIAnyExecuteParams]r����r���r���r���)rI���r/���r���zCallable[..., ExecutionContext]r/���Union[str, Compiled]r0��� Optional[_AnyMultiExecuteParams]r����r,���r���r���rt���r���r���r���) rI���r/���r���r���r/��r���r0��r���r���r���)rI���r/���r���r���r���r���) r���r���r/��r|��r0��r+���r����Optional[ExecutionContext]r���r���)r���r���r���r���)r����r����r/��r���r0��zOptional[_AnyExecuteParams]r����Optional[DBAPICursor]r���r���r���r����r���r���)NNTF)r����r����rI���r/���rU����Optional[Engine]r���r���r���r����r���r����r���r����r���z+Type[Union[SchemaGenerator, SchemaDropper]]r���rA���r���r���r���r���)P�__name__� __module__�__qualname__�__doc__�__annotations__�_sqla_logger_namespacerL����should_close_with_resultrh���ri���rv���rz����propertyr~���r����r����r����r ���r����r����r����r����r����rd���r����r����r����r����rp���r����r����r����r����r����r����r����r����r����r����r����r����r����r����r����r����r����r����r��r��r ��r��r��r��r��r��r#��r&��r����r1��r<��rA��rJ��rW��r_��rM��rG��rE���rw��rz��rZ��r���r���r���r���r���r���r�����classmethodrY���r���r����rw���rg���rH���rH���W���s�������0���0�0�;���>B��:�A� � %��6�6�'�'�+�+�4�4� �7;�&*�"&�!%� +/��+/��4�+/��$� +/� � �+/��� +/�^�#���"� 5� 6���$���$��(�����7:� �*-�#�$�!��*-�AD�"'���4���� � �(���� �����������%(���?��� ������ ����� ��>���>�E�N '��� ��� ���K���K� ��H���H�(��*���*�2*D�X��4���4�8 �C���$���$�9&�v")�H�I�VL'�\.�:'�2)�4=�M�K�M� � ���!�(�$�,H�$D�"�E�=�$�D�H�D�.%�`���:>�� �DH��.���7�� �A��� � �������:>�� �DH�����7�� �A��� � �����:>�� �DH�����7�� �A��� � �:���7;�� �DH��.���4�� �A��� � �������7;� � �DH� �� ��4� � �A� �� � ��� ��7;�� �DH�����4�� �A��� � �2���7;�� �DH��'���4�� �A��� � �������7;� � �DH� �� ��4� � �A� �� � ��� ��7;�0� �DH�0��0��4�0� �A�0�� � 0�d �"� ��6� ��7� � � � �9�!�9��6�9��7� 9� � �9�v3� !�3��6�3��7� 3� � �3�j(G��(G��2�(G��+� (G� �(G�TG��G��6�G��7� G� � �G�Z�:O� 0��0��6�0��7� 0� � �0�j�8<�CG� K��K��5�K��A� K� � �K�Z9��9��5�9��(� 9� �5�9��+� 9���9���9�� �9�vL��L��"�L��(� L� �5�L�� � L�\i��i��"�i�� � i�`�/3�,��,���,��.� ,� �,�,�� � ,�\�����N��"�O'��O'��!�O'��0� O'� �&�O'��,� O'���O'�� �O'�b�� �$(�(,�.2�!�J:��J:���J:��!� J:� �&�J:��(,� J:���J:�� �J:���J:�XO�D�O���O��� O� � �Orw���rH���r1���c�������������������L�����e�Zd�ZdZdZ � � � � � � � � � � � � � � � � � � � � � � � �dd�Zy)r���z3Implement the :class:`.ExceptionContext` interface.) rd���rU���rI���r���r/��r0���original_exceptionr���r����execution_contextr���r���r���c ����������������������||�_���������||�_��������||�_��������||�_��������||�_��������| |�_��������||�_��������||�_��������| |�_��������||�_ ��������||�_ ��������y�r����)rU���rI���rd���r���r��r ��r/��r0��r���r���r���) rc���r����r���rU���rI���rd���r���r/��r0��r���r���r���r���s ��� rg���rh���zExceptionContextImpl.__init__� ��sW�������������$���$8��!�"+���!(���"���$���*���-J��*�&��rw���N)r����r����r���zOptional[exc.StatementError]rU���r���rI���r/���rd����Optional[Connection]r���r���r/��r���r0��r���r���r���r���r����r���r����r���r����)r��r��r��r��� __slots__rh���r����rw���rg���r���r���� ��s�������=��I� '� �'��;�'��!� '� ��'��)� '��&�'��!�'��5�'��,�'���'��(,�'���'rw���r���c������������������������e�Zd�ZU�dZdZdZded<���ded<���ded<���dd �Zedd ���������Z dd�Z dd�Zdd �Zedd���������Z dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zy)�Transactiona~��Represent a database transaction in progress. The :class:`.Transaction` object is procured by calling the :meth:`_engine.Connection.begin` method of :class:`_engine.Connection`:: from sqlalchemy import create_engine engine = create_engine("postgresql+psycopg2://scott:tiger@localhost/test") connection = engine.connect() trans = connection.begin() connection.execute(text("insert into x (a, b) values (1, 2)")) trans.commit() The object provides :meth:`.rollback` and :meth:`.commit` methods in order to control transaction boundaries. It also implements a context manager interface so that the Python ``with`` statement can be used with the :meth:`_engine.Connection.begin` method:: with connection.begin(): connection.execute(text("insert into x (a, b) values (1, 2)")) The Transaction object is **not** threadsafe. .. seealso:: :meth:`_engine.Connection.begin` :meth:`_engine.Connection.begin_twophase` :meth:`_engine.Connection.begin_nested` .. index:: single: thread safety; Transaction r����Fr�����_is_rootr����rH���rd���c����������������������t�����������������r������NotImplementedError�rc���rd���s��� rg���rh���zTransaction.__init__� ���������!�#�#rw���c����������������������t�����������������)z�True if this transaction is totally deactivated from the connection and therefore can no longer affect its state. r��r����s��� rg����_deactivated_from_connectionz(Transaction._deactivated_from_connection� ��s �������"�#�#rw���c����������������������t�����������������r����r��r����s��� rg���� _do_closezTransaction._do_close ��r��rw���c����������������������t�����������������r����r��r����s��� rg����_do_rollbackzTransaction._do_rollback ��r��rw���c����������������������t�����������������r����r��r����s��� rg���� _do_commitzTransaction._do_commit ��r��rw���c�����������������L�����|�j�������������������xr�|�j������������������j�������������������S�r����)r����rd���r����r����s��� rg���r����zTransaction.is_valid ��s�������~�~�A�d�o�o�&A�&A�"A�Arw���c�����������������h����� �|�j���������������������������|�j������������������rJ��y#�|�j������������������rJ��w�xY�w)a;��Close this :class:`.Transaction`. If this transaction is the base transaction in a begin/commit nesting, the transaction will rollback(). Otherwise, the method returns. This is used to cancel a Transaction without affecting the scope of an enclosing transaction. N)r��r����r����s��� rg���r����zTransaction.close ��s0������ &��N�N���~�~�%�%�~��t�~�~�%�%�~������!��1c�����������������h����� �|�j���������������������������|�j������������������rJ��y#�|�j������������������rJ��w�xY�w)a���Roll back this :class:`.Transaction`. The implementation of this may vary based on the type of transaction in use: * For a simple database transaction (e.g. :class:`.RootTransaction`), it corresponds to a ROLLBACK. * For a :class:`.NestedTransaction`, it corresponds to a "ROLLBACK TO SAVEPOINT" operation. * For a :class:`.TwoPhaseTransaction`, DBAPI-specific methods for two phase transactions may be used. N)r��r����r����s��� rg���r����zTransaction.rollback ��s2������" &������~�~�%�%�~��t�~�~�%�%�~�r#��c�����������������h����� �|�j���������������������������|�j������������������rJ��y#�|�j������������������rJ��w�xY�w)a���Commit this :class:`.Transaction`. The implementation of this may vary based on the type of transaction in use: * For a simple database transaction (e.g. :class:`.RootTransaction`), it corresponds to a COMMIT. * For a :class:`.NestedTransaction`, it corresponds to a "RELEASE SAVEPOINT" operation. * For a :class:`.TwoPhaseTransaction`, DBAPI-specific methods for two phase transactions may be used. N)r ��r����r����s��� rg���r����zTransaction.commit4 ��s0������ &��O�O���~�~�%�%�~��t�~�~�%�%�~�r#��c����������������������|�j�������������������S�r����)rd���r����s��� rg����_get_subjectzTransaction._get_subjectI ��s���������rw���c����������������������|�j�������������������S�r����)r����r����s��� rg����_transaction_is_activez"Transaction._transaction_is_activeL ��s�������~�~�rw���c����������������������|�j��������������������S�r����)r��r����s��� rg����_transaction_is_closedz"Transaction._transaction_is_closedO ��s�������4�4�4�4rw���c�����������������������y�NTr����r����s��� rg����_rollback_can_be_calledz#Transaction._rollback_can_be_calledR ��s������ �rw���N�rd���rH���r���r���r���)r��r��r��r��r��r��r��rh���r ��r��r��r��r ��r����r����r����r����r'��r)��r+��r.��r����rw���rg���r��r��� ��s�������#�J��I��H�d���O���$���$���$�$�$�$���B���B�&� &�,&�*��5�rw���r��c�������������������t�����e�Zd�ZdZdZdZdd�Zdd�Zedd���������Z dd�Z dd�Zdd �Zddd �Z dd�Zdd�Zdd �Zy)r����a���Represent the "root" transaction on a :class:`_engine.Connection`. This corresponds to the current "BEGIN/COMMIT/ROLLBACK" that's occurring for the :class:`_engine.Connection`. The :class:`_engine.RootTransaction` is created by calling upon the :meth:`_engine.Connection.begin` method, and remains associated with the :class:`_engine.Connection` throughout its active span. The current :class:`_engine.RootTransaction` in use is accessible via the :attr:`_engine.Connection.get_transaction` method of :class:`_engine.Connection`. In :term:`2.0 style` use, the :class:`_engine.Connection` also employs "autobegin" behavior that will create a new :class:`_engine.RootTransaction` whenever a connection in a non-transactional state is used to emit commands on the DBAPI connection. The scope of the :class:`_engine.RootTransaction` in 2.0 style use can be controlled using the :meth:`_engine.Connection.commit` and :meth:`_engine.Connection.rollback` methods. T)rd���r����c����������������������|j��������������������J��|j������������������rt��������j������������������|��������||�_��������|�j���������������������������|�|_���������d|�_��������y�r-��)rQ���rL���r���r}��rd����_connection_begin_implr����r��s��� rg���rh���zRootTransaction.__init__t ��sM�������&�&�.�.�.��,�,� �1�1�*�=�$����#�#�%�"&� ����rw���c����������������������|�j�������������������r"|�j������������������j������������������|�u�sJ��d|�_���������y�|�j������������������j������������������|�urt��������j������������������d��������y�y�)NFz0transaction already deassociated from connection)r����rd���rQ���r!����warnr����s��� rg����_deactivate_from_connectionz+RootTransaction._deactivate_from_connection~ ��sL�������>�>��?�?�/�/�4�7�7�7�"�D�N� �_�_� )� )�� 5��I�I�H�I��6rw���c�����������������2�����|�j�������������������j������������������|�uS�r����)rd���rQ���r����s��� rg���r��z,RootTransaction._deactivated_from_connection� ��s���������+�+�4�7�7rw���c�����������������:�����|�j�������������������j������������������|���������y�r����)rd���r��r����s��� rg���r2��z&RootTransaction._connection_begin_impl� ��s���������#�#�D�)rw���c�����������������8�����|�j�������������������j���������������������������y�r����)rd���r��r����s��� rg����_connection_rollback_implz)RootTransaction._connection_rollback_impl� ��s���������&�&�(rw���c�����������������8�����|�j�������������������j���������������������������y�r����)rd���r ��r����s��� rg����_connection_commit_implz'RootTransaction._connection_commit_impl� ��s���������$�$�&rw���c�����������������,���� �|�j�������������������r|�j���������������������������|�j������������������j������������������r$|�j������������������j������������������j ���������������������������|�j�������������������s|r|�j���������������������������|�j������������������j������������������|�u�rd�|�j������������������_�������� �|�j�������������������rJ��|�j������������������j������������������|�usJ��y�#�|�j�������������������s|r|�j���������������������������|�j������������������j������������������|�u�rd�|�j������������������_��������w�w�xY�wr����)r����r9��rd���rS����_cancelr5��rQ���)rc����try_deactivates��� rg����_close_implzRootTransaction._close_impl� ��s������� 4��~�~��.�.�0����2�2����3�3�;�;�=��~�~���0�0�2����+�+�t�3�/3����,��>�>�!�!����+�+�4�7�7�7�� ��~�~���0�0�2����+�+�t�3�/3����,��4�s ����AC �� A Dc�����������������$�����|�j���������������������������y�r�����r?��r����s��� rg���r��zRootTransaction._do_close� ��s���������rw���c�����������������(�����|�j������������������d���������y�)NT)r>��rA��r����s��� rg���r��zRootTransaction._do_rollback� ��s�����������-rw���c���������������������|�j�������������������r�|�j������������������j������������������|�u�sJ�� �|�j���������������������������|�j������������������j������������������r$|�j������������������j������������������j���������������������������|�j ���������������������������d�|�j������������������_��������nH|�j������������������j������������������|�u�r|�j������������������j���������������������������nt��������j������������������d��������|�j�������������������rJ��|�j������������������j������������������|�usJ��y�#�|�j������������������j������������������r$|�j������������������j������������������j���������������������������|�j ���������������������������w�xY�w)N�This transaction is inactive) r����rd���rQ���r;��rS���r=��r5��r����r���r����r����s��� rg���r ��zRootTransaction._do_commit� ��s��������>�>��?�?�/�/�4�7�7�7� 3��,�,�.� ��?�?�6�6��O�O�7�7�?�?�A��0�0�2� �,0�D�O�O�(����+�+�t�3����4�4�6��-�-�.L�M�M��>�>�!�!����+�+�4�7�7�7��!��?�?�6�6��O�O�7�7�?�?�A��0�0�2�s����D��AENr/��r���r���r���)r>��r����r���r���)r��r��r��r��r��r��rh���r5��r ��r��r2��r9��r;��r?��r��r��r ��r����rw���rg���r����r����Z ��sU�������*��H�+�I��J���8���8�*�)�'�8� �.�8rw���r����c�������������������x�����e�Zd�ZU�dZdZded<���dd�Zddd�Zedd���������Z dd�Z � � � � � �dd �Zdd �Zdd�Z dd�Zy )r����a���Represent a 'nested', or SAVEPOINT transaction. The :class:`.NestedTransaction` object is created by calling the :meth:`_engine.Connection.begin_nested` method of :class:`_engine.Connection`. When using :class:`.NestedTransaction`, the semantics of "begin" / "commit" / "rollback" are as follows: * the "begin" operation corresponds to the "BEGIN SAVEPOINT" command, where the savepoint is given an explicit name that is part of the state of this object. * The :meth:`.NestedTransaction.commit` method corresponds to a "RELEASE SAVEPOINT" operation, using the savepoint identifier associated with this :class:`.NestedTransaction`. * The :meth:`.NestedTransaction.rollback` method corresponds to a "ROLLBACK TO SAVEPOINT" operation, using the savepoint identifier associated with this :class:`.NestedTransaction`. The rationale for mimicking the semantics of an outer transaction in terms of savepoints so that code may deal with a "savepoint" transaction and an "outer" transaction in an agnostic way. .. seealso:: :ref:`session_begin_nested` - ORM version of the SAVEPOINT API. )rd���r����� _savepoint�_previous_nestedr|��rF��c�����������������������|j��������������������J��|j������������������rt��������j������������������|��������||�_��������|�j������������������j��������������������������|�_��������d|�_��������|j������������������|�_ ��������|�|_��������y�r-��) rQ���rL���r���r}��rd���r��rF��r����rS���rG��r��s��� rg���rh���zNestedTransaction.__init__� ��sc�������&�&�2�2�2��,�,� �1�1�*�=�$����/�/�9�9�;������ *� >� >���)-� �&rw���c����������������������|�j�������������������j������������������|�u�r|�j������������������|�j�������������������_��������y�|rt��������j������������������d��������y�y�)Nz7nested transaction already deassociated from connection)rd���rS���rG��r!���r4��)rc���r4��s��� rg���r5��z-NestedTransaction._deactivate_from_connection� ��s=�������?�?�.�.�$�6�26�2G�2G�D�O�O�/� ��I�I�I� ��rw���c�����������������2�����|�j�������������������j������������������|�uS�r����)rd���rS���r����s��� rg���r��z.NestedTransaction._deactivated_from_connection� ��s���������2�2�$�>�>rw���c����������������������d|�_���������|�j���������������������������|�j������������������r|�j������������������j���������������������������y�y��NF)r����r5��rG��r=��r����s��� rg���r=��zNestedTransaction._cancel���s7�����������(�(�*�� � ��!�!�)�)�+��!rw���c��������������������� �|�j�������������������r[|�j������������������j������������������rE|�j������������������j������������������j�������������������r%|�j������������������j������������������|�j��������������������������d|�_���������|r|�j������������������|��������� �|�j�������������������rJ��|r|�j������������������j������������������|�usJ��y�y�#�d|�_���������|r|�j������������������|���������w�w�xY�w)NF)r4��)r����rd���rQ���r��rF��r5��rS���)rc����deactivate_from_connection�warn_already_deactives��� rg���r?��zNestedTransaction._close_impl ��s������� M�����O�O�0�0��O�O�0�0�:�:����;�;�D�O�O�L�"�D�N�)��0�0�6K�0�L��>�>�!�!�%��?�?�6�6�d�B�B�B��&�� �#�D�N�)��0�0�6K�0�L��*�s����A'B1��1Cc�����������������(�����|�j������������������dd��������y�)NTFrA��r����s��� rg���r��zNestedTransaction._do_close��s����������u�%rw���c�����������������(�����|�j������������������dd��������y�r-��rA��r����s��� rg���r��zNestedTransaction._do_rollback ��s����������t�$rw���c�����������������>����|�j�������������������r> �|�j������������������j������������������|�j��������������������������d|�_���������|�j ���������������������������y�|�j������������������j ������������������|�u�r|�j������������������j ���������������������������y�t��������j������������������d��������#�d|�_���������w�xY�w)NFz#This nested transaction is inactive) r����rd���r��rF��r5��rS���r����r���r����r����s��� rg���r ��zNestedTransaction._do_commit#��s~�������>�>� '����7�7����H� �"'���� �,�,�.����2�2�d�:����4�4�6��-�-�9������"'���s����%B�� BNr/���T)r4��r����r���r���r���r���)rN��r����rO��r����r���r���)r��r��r��r��r��r��rh���r5��r ��r��r=��r?��r��r��r ��r����rw���rg���r����r����� ��sg�������>�N�I��O�.����?���?�,�C�*.�C�GK�C� �C�(&�%�rw���r����c�������������������T�������e�Zd�ZU�dZdZded<���d ��fd�Zdd�Zdd�Zdd�Z dd �Z ��xZS�)r����a��Represent a two-phase transaction. A new :class:`.TwoPhaseTransaction` object may be procured using the :meth:`_engine.Connection.begin_twophase` method. The interface is the same as that of :class:`.Transaction` with the addition of the :meth:`prepare` method. )r�����_is_preparedr���r����c�����������������@������d|�_���������||�_��������t���������|�� ��|��������y�rL��)rU��r�����superrh���)rc���rd���r����� __class__s��� �rg���rh���zTwoPhaseTransaction.__init__G��s�������!������ ����$rw���c����������������������|�j�������������������st��������j������������������d��������|�j������������������j ������������������|�j ��������������������������d|�_��������y)zqPrepare this :class:`.TwoPhaseTransaction`. After a PREPARE, the transaction can be committed. rD��TN)r����r���r����rd���r��r����rU��r����s��� rg����preparezTwoPhaseTransaction.prepareL��s;��������~�~��)�)�*H�I�I����.�.�t�x�x�8� ��rw���c�����������������:�����|�j�������������������j������������������|���������y�r����)rd���r��r����s��� rg���r2��z*TwoPhaseTransaction._connection_begin_implW��s���������,�,�T�2rw���c�����������������d�����|�j�������������������j������������������|�j������������������|�j��������������������������y�r����)rd���r#��r����rU��r����s��� rg���r9��z-TwoPhaseTransaction._connection_rollback_implZ��s ���������/�/����$�:K�:K�Lrw���c�����������������d�����|�j�������������������j������������������|�j������������������|�j��������������������������y�r����)rd���r&��r����rU��r����s��� rg���r;��z+TwoPhaseTransaction._connection_commit_impl]��s ���������-�-�d�h�h��8I�8I�Jrw���)rd���rH���r����r���r���)r��r��r��r��r��r��rh���rZ��r2��r9��r;��� __classcell__)rX��s���@rg���r����r����8��s/���������(�I� �H�%� !�3�M�Krw���r����c�������������������:����e�Zd�ZU�dZded<���ded<���eZded<���dZd ed <���eZ ded<���d Z ded<���dZd ed<���dZded<���ded<���ded<���ded<���ded<���d ed<��� � � � � �d1 � � � � � � � � � � � � � � �d2d�Z d3d�Zed4d���������Zd5d �Zd6d!�Zed"d"d"d"d"d#� � � � � � � � � � � � � �d7d$���������Zed8d%���������Zd8d&�Zd9d'�Zed:d(���������Zed:d)���������Z�ej2��������������������������Zd:d*�Zd;d<d+�Zej<������������������ �d= � � �d>d,���������Zej<������������������d?d-���������Z � � � � � � � �d@d.�Z!dAd/�Z"dBd0�Z#y)Cr���a��� Connects a :class:`~sqlalchemy.pool.Pool` and :class:`~sqlalchemy.engine.interfaces.Dialect` together to provide a source of database connectivity and behavior. An :class:`_engine.Engine` object is instantiated publicly using the :func:`~sqlalchemy.create_engine` function. .. seealso:: :doc:`/core/engines` :ref:`connections_toplevel` rJ���rK���r���rm��r,���rO���Fr����ra���zType[Connection]�_connection_clszsqlalchemy.engine.Enginer|��r��� _is_futureNr���r~���zType[OptionEngine]�_option_clsr/���rI���r6���r���r2����urlr���c ���������������������||�_���������||�_��������||�_��������|r||�_��������||�_��������||�_��������|dk7��r't ��������j������������������||�j��������������������������|�_ ��������nd�|�_ ��������t��������j������������������|�|���������|r�|�j������������������di�|���y�y�)Nr���)� size_alert��echoflagr����) r���rc��rI����logging_name�echor���r!����LRUCache�_lru_size_alertrm��r ����instance_logger�update_execution_options) rc���r���rI���rc��rh��ri���query_cache_sizer����r���s ��� rg���rh���zEngine.__init__���s���������� �������� ,�D���� �.����q� �#'�=�=� �T�-A�-A�$�D� ��$(�D� ����D�4�0��)�D�)�)�>�,=�>��rw���c����������������������|�j��������������������������r1|�j������������������j������������������dt��������|�������|j��������������������������y�y�)NziCompiled cache size pruning from %d items to %d. Increase cache size to reduce the frequency of pruning.)r^���ro���rp���ra���capacity)rc����caches��� rg���rk��zEngine._lru_size_alert���s9������� � �"��K�K���J��E� ���� ��#rw���c����������������������|�S�)z�Returns this :class:`.Engine`. Used for legacy schemes that accept :class:`.Connection` / :class:`.Engine` objects within the same variable. r����r����s��� rg���rU���z Engine.engine���s ��������rw���c�����������������R�����|�j�������������������r|�j�������������������j���������������������������yy)a���Clear the compiled cache associated with the dialect. This applies **only** to the built-in cache that is established via the :paramref:`_engine.create_engine.query_cache_size` parameter. It will not impact any dictionary caches that were passed via the :paramref:`.Connection.execution_options.compiled_cache` parameter. .. versionadded:: 1.4 N)rm���clearr����s��� rg����clear_compiled_cachezEngine.clear_compiled_cache���s$����������� � �&�&�(�� rw���c����������������������|�j�������������������j������������������|�|��������|�j������������������j������������������|�������|�_��������|�j������������������j������������������|�|��������y)a���Update the default execution_options dictionary of this :class:`_engine.Engine`. The given keys/values in \**opt are added to the default execution options that will be used for all connections. The initial contents of this dictionary can be sent via the ``execution_options`` parameter to :func:`_sa.create_engine`. .. seealso:: :meth:`_engine.Connection.execution_options` :meth:`_engine.Engine.execution_options` N)rK����set_engine_execution_optionsrO���r����rI���r����s��� rg���rm��zEngine.update_execution_options���sE������"� � � �2�2�4��=�"&�"9�"9�"?�"?��"D������1�1�$��<rw���.)r����r����r����r����r|���c����������������������y�r����r����)rc���r����r����r����r����r|���r����s��� rg���r����zEngine.execution_options���s�������rw���c�����������������������y�r����r����r����s��� rg���r����zEngine.execution_options���s������=@rw���c�����������������&�����|�j������������������|�|�������S�)a��Return a new :class:`_engine.Engine` that will provide :class:`_engine.Connection` objects with the given execution options. The returned :class:`_engine.Engine` remains related to the original :class:`_engine.Engine` in that it shares the same connection pool and other state: * The :class:`_pool.Pool` used by the new :class:`_engine.Engine` is the same instance. The :meth:`_engine.Engine.dispose` method will replace the connection pool instance for the parent engine as well as this one. * Event listeners are "cascaded" - meaning, the new :class:`_engine.Engine` inherits the events of the parent, and new events can be associated with the new :class:`_engine.Engine` individually. * The logging configuration and logging_name is copied from the parent :class:`_engine.Engine`. The intent of the :meth:`_engine.Engine.execution_options` method is to implement schemes where multiple :class:`_engine.Engine` objects refer to the same connection pool, but are differentiated by options that affect some execution-level behavior for each engine. One such example is breaking into separate "reader" and "writer" :class:`_engine.Engine` instances, where one :class:`_engine.Engine` has a lower :term:`isolation level` setting configured or is even transaction-disabled using "autocommit". An example of this configuration is at :ref:`dbapi_autocommit_multiple`. Another example is one that uses a custom option ``shard_id`` which is consumed by an event to change the current schema on a database connection:: from sqlalchemy import event from sqlalchemy.engine import Engine primary_engine = create_engine("mysql+mysqldb://") shard1 = primary_engine.execution_options(shard_id="shard1") shard2 = primary_engine.execution_options(shard_id="shard2") shards = {"default": "base", "shard_1": "db1", "shard_2": "db2"} @event.listens_for(Engine, "before_cursor_execute") def _switch_shard(conn, cursor, stmt, params, context, executemany): shard_id = conn.get_execution_options().get("shard_id", "default") current_shard = conn.info.get("current_shard", None) if current_shard != shard_id: cursor.execute("use %s" % shards[shard_id]) conn.info["current_shard"] = shard_id The above recipe illustrates two :class:`_engine.Engine` objects that will each serve as factories for :class:`_engine.Connection` objects that have pre-established "shard_id" execution options present. A :meth:`_events.ConnectionEvents.before_cursor_execute` event handler then interprets this execution option to emit a MySQL ``use`` statement to switch databases before a statement execution, while at the same time keeping track of which database we've established using the :attr:`_engine.Connection.info` dictionary. .. seealso:: :meth:`_engine.Connection.execution_options` - update execution options on a :class:`_engine.Connection` object. :meth:`_engine.Engine.update_execution_options` - update the execution options for a given :class:`_engine.Engine` in place. :meth:`_engine.Engine.get_execution_options` )rb��r����s��� rg���r����zEngine.execution_options���s������\�����c�*�*rw���c����������������������|�j�������������������S�)z�Get the non-SQL options which will take effect during execution. .. versionadded: 1.3 .. seealso:: :meth:`_engine.Engine.execution_options` r����r����s��� rg���r����zEngine.get_execution_options7��r����rw���c�����������������.�����|�j�������������������j������������������S�)zsString name of the :class:`~sqlalchemy.engine.interfaces.Dialect` in use by this :class:`Engine`. )rI���r����r����s��� rg���r����zEngine.nameB��s��������|�|� � � rw���c�����������������.�����|�j�������������������j������������������S�)zsDriver name of the :class:`~sqlalchemy.engine.interfaces.Dialect` in use by this :class:`Engine`. )rI����driverr����s��� rg���r~��z Engine.driverK��s��������|�|�"�"�"rw���c�����������������"�����d|�j��������������������d�S�)NzEngine(r���)rc��r����s��� rg����__repr__zEngine.__repr__V��s������#�x�x�)�)rw���c����������������������|r|�j�������������������j���������������������������|�j�������������������j��������������������������|�_���������|�j������������������j ������������������|���������y)a��Dispose of the connection pool used by this :class:`_engine.Engine`. A new connection pool is created immediately after the old one has been disposed. The previous connection pool is disposed either actively, by closing out all currently checked-in connections in that pool, or passively, by losing references to it but otherwise not closing any connections. The latter strategy is more appropriate for an initializer in a forked Python process. :param close: if left at its default of ``True``, has the effect of fully closing all **currently checked in** database connections. Connections that are still checked out will **not** be closed, however they will no longer be associated with this :class:`_engine.Engine`, so when they are closed individually, eventually the :class:`_pool.Pool` which they are associated with will be garbage collected and they will be closed out fully, if not already closed on checkin. If set to ``False``, the previous connection pool is de-referenced, and otherwise not touched in any way. .. versionadded:: 1.4.33 Added the :paramref:`.Engine.dispose.close` parameter to allow the replacement of a connection pool in a child process without interfering with the connections used by the parent process. .. seealso:: :ref:`engine_disposal` :ref:`pooling_multiprocessing` N)r����dispose�recreaterK����engine_disposed)rc���r����s��� rg���r���zEngine.disposeY��s>������J���I�I�����I�I�&�&�(�� �� � �%�%�d�+rw���c��������������#���l���K����|�|�j��������������������������5�}|���d�d�d���������y�|���y�#�1�sw�Y���y�xY�w�wr����)�connect)rc���rd���r+��s��� rg����_optional_conn_ctx_managerz!Engine._optional_conn_ctx_manager���s4����������������4�� �� ������ ��s����4�(�4�1�4c��������������#������K����|�j��������������������������5�}|j��������������������������5��|���ddd��������ddd��������y#�1�sw�Y����xY�w#�1�sw�Y���yxY�w�w)a��Return a context manager delivering a :class:`_engine.Connection` with a :class:`.Transaction` established. E.g.:: with engine.begin() as conn: conn.execute(text("insert into table (x, y, z) values (1, 2, 3)")) conn.execute(text("my_special_procedure(5)")) Upon successful operation, the :class:`.Transaction` is committed. If an error is raised, the :class:`.Transaction` is rolled back. .. seealso:: :meth:`_engine.Engine.connect` - procure a :class:`_engine.Connection` from an :class:`_engine.Engine`. :meth:`_engine.Connection.begin` - start a :class:`.Transaction` for a particular :class:`_engine.Connection`. N)r���r����)rc���r+��s��� rg���r����zEngine.begin���s:���������2��\�\�^�t������ �����^������^�s.����A�A�:�A� A�A �A�A�Ac�����������������v�����|�j��������������������������5�}�|j������������������||fi�|���d�d�d���������y�#�1�sw�Y���y�xY�wr����)r����r���)rc���r���r���r���r+��s��� rg���r���zEngine._run_ddl_visitor���s0��������Z�Z�\�T�!�D�!�!�/�7�E�f�E���\�\�s����/�8c�����������������$�����|�j������������������|��������S�)a<��Return a new :class:`_engine.Connection` object. The :class:`_engine.Connection` acts as a Python context manager, so the typical use of this method looks like:: with engine.connect() as connection: connection.execute(text("insert into table values ('foo')")) connection.commit() Where above, after the block is completed, the connection is "closed" and its underlying DBAPI resources are returned to the connection pool. This also has the effect of rolling back any transaction that was explicitly begun or was begun via autobegin, and will emit the :meth:`_events.ConnectionEvents.rollback` event if one was started and is still in progress. .. seealso:: :meth:`_engine.Engine.begin` )r`��r����s��� rg���r���zEngine.connect���s������.��#�#�D�)�)rw���c�����������������6�����|�j�������������������j��������������������������S�)aC��Return a "raw" DBAPI connection from the connection pool. The returned object is a proxied version of the DBAPI connection object used by the underlying driver in use. The object will have all the same behavior as the real DBAPI connection, except that its ``close()`` method will result in the connection being returned to the pool, rather than being closed for real. This method provides direct DBAPI connection access for special situations when the API provided by :class:`_engine.Connection` is not needed. When a :class:`_engine.Connection` object is already present, the DBAPI connection is available using the :attr:`_engine.Connection.connection` accessor. .. seealso:: :ref:`dbapi_connections` )r���r���r����s��� rg���rV���zEngine.raw_connection���s������,��y�y� � �"�"rw���)NNi���NF)r���r6���rI���r/���rc��r2���rh��r���ri��zOptional[_EchoFlagType]rn��r���r����zOptional[Mapping[str, Any]]r���r����)rq��zutil.LRUCache[Any, Any]r���r���)r���r���r����r����r���r���r���)r����r���r����r|��r����r���r����r���r|���r���r����r���r����OptionEngine)r����r���r���r���r���)r���r|��rS��)r����r����r���r���r����)rd���r��r����Iterator[Connection])r���r���r��r���r���)$r��r��r��r��r��rE���rO���ra���rH���r`��r��ra��r~���rh���rk��r ��rU���ru��rm��r ���r����r����r����r~��r ���� echo_propertyri��r���r���� contextlib�contextmanagerr���r����r���r���rV���r����rw���rg���r���r���a��sF������ �1�0�0�0�*?���?��K���(2�O�%�2�"<��C�<��J���>B��;�B�#�#� �� �J� �H����'+�(,� #�9=� %�?��?���?��� ?� �$�?��&� ?���?��7�?���?�8�������)�=�*���7:� �*-�*-�AD� ��4� ��� � �(� ��%(� ��?� ��� �� � ��� ���@���@�N+�` '���!���!���#���#���3����D�*�(,�T����15��.�� �������������8F�D�F���F��� F� � �F�*�2#rw���r���c������������������������e�Zd�ZU�dZded<���ded<���ded<���ded <���d ed<���ded <���ded<��� � � � �dd�Zdd�Zej������������������s9e dd���������Z e j������������������dd���������Z e dd���������Zej������������������dd���������Zyy)�OptionEngineMixinFrJ���rK���r���rm��r/���rI���r6���r���r2���rc��r����r���zlog.echo_propertyri��c���������������������||�_���������|j������������������|�_��������|j������������������|�_��������|j������������������|�_��������|j������������������|�_��������|j ������������������|�_��������|j������������������|�_��������t��������j������������������|�|�j���������������������������|�j������������������j������������������|j�������������������������|�_ ��������|j������������������|�_���������|�j������������������di�|���y�)Nrf��r����) �_proxiedrc��rI���rh��ri��rm��r���r ���rl��rK���r`���rO���rm��)rc����proxiedr����s��� rg���rh���zOptionEngineMixin.__init__���s�������� �� ��;�;��������#�0�0����L�L�� �&�6�6���&�6�6������D�4�9�9�5��� � �+�+�G�,<�,<�=�� �")�"<�"<���%��%�%�:�(9�:rw���c����������������������t�����������������r����r��r����s��� rg���rm��z*OptionEngineMixin.update_execution_options ��r��rw���c�����������������.�����|�j�������������������j������������������S�r�����r���r���r����s��� rg���r���zOptionEngineMixin.pool ��s�������=�=�%�%�%rw���c�����������������&�����||�j�������������������_��������y�r����r���)rc���r���s��� rg���r���zOptionEngineMixin.pool ��s������!%�D�M�M�rw���c�����������������j�����|�j�������������������j������������������xs�|�j������������������j������������������dd�������S�)Nra���F)r���ra����__dict__r}���r����s��� rg���ra���zOptionEngineMixin._has_events ��s/�������=�=�,�,���� � �0A�0A��u�1�� rw���c�����������������"�����||�j�������������������d<���y�)Nra���)r���)rc���r����s��� rg���ra���zOptionEngineMixin._has_events! ��s������+0�D�M�M�-�(rw���N)r���r���r����r.���r���)r���r6���)r���r6���r���r���r���)r����r����r���r���) r��r��r���_sa_propagate_class_eventsr��rh���rm���typing� TYPE_CHECKINGr ��r����setterra���r����rw���rg���r���r������s�������!&��0�0�0�0� �� �J� �H��� ��;��;�2M�;�:$������ � &�� � &�� ��� &�� � &�� � �� � � � � � � 1�� � 1�%� rw���r���c������������������������e�Zd�Zdd�Zy)r���c�����������������0�����t��������j������������������|�fi�|���y�r����)r���rm��r����s��� rg���rm��z%OptionEngine.update_execution_options' ��s�������'�'��4��4rw���Nr���)r��r��r��rm��r����rw���rg���r���r���& ��s������5rw���r���)cr��� __future__r���r���r���r���r���r���r���r���r���r ���r ���r���r���r ���r���r���r���r���� interfacesr���r���r���r���r���r���r���r!���r���r���r���r����r���r���r ����sqlr"���r���r���r#���r$���r%���r&���r'���r(���r)���r*���r+���r,���r-���r.���r/���r0���� reflectionr1���rc��r2����eventr3���r4���r���r5���r6���r7���r8����sql._typingr9����sql.compilerr:����sql.ddlr;���r<���r=���� sql.functionsr>���� sql.schemar?���r@���rA����sql.selectablerB���rC���� EMPTY_DICTrE���r��rF����InspectablerH���r���r��r����r����r����� Identifiedr���r���r���rb��r����rw���rg����<module>r������s�������#���� �� ������������������������������"��.��#��(��$��(��&��$��%��&������������"� �����-�2�1�3�4�2�5�+�-�7�#�2�%��"�#�'��,� �'�'�.�'�)�/�-�*�'�1�� �T����)-�������8� $��� ���/�A%O�'��)?�)?��)L��A%O�HJ,'�+��,'�^M�&��M�`i8�k��i8�Xo���o�d&K�/��&K�RA#��C�N�N�J�,B�,B�;�,O�A#�H>1�����>1�B5�$�f��5� �"���rw���