?????????? ????????? - ??????????????? - /home/agenciai/.local/lib/python3.9/site-packages/sqlalchemy/dialects/sqlite/__pycache__/aiosqlite.cpython-39.pyc
???????
a ��Jh�/ � @ s� d Z ddlZddlmZ ddlmZ ddlmZ ddlm Z dd l mZ dd l mZ ddl mZ ddlmZ dd lmZ G dd� d�ZG dd� de�ZG dd� de�ZG dd� de�ZG dd� d�ZG dd� de�ZG dd� de �ZeZdS )a� .. dialect:: sqlite+aiosqlite :name: aiosqlite :dbapi: aiosqlite :connectstring: sqlite+aiosqlite:///file_path :url: https://pypi.org/project/aiosqlite/ The aiosqlite dialect provides support for the SQLAlchemy asyncio interface running on top of pysqlite. aiosqlite is a wrapper around pysqlite that uses a background thread for each connection. It does not actually use non-blocking IO, as SQLite databases are not socket-based. However it does provide a working asyncio interface that's useful for testing and prototyping purposes. Using a special asyncio mediation layer, the aiosqlite dialect is usable as the backend for the :ref:`SQLAlchemy asyncio <asyncio_toplevel>` extension package. This dialect should normally be used only with the :func:`_asyncio.create_async_engine` engine creation function:: from sqlalchemy.ext.asyncio import create_async_engine engine = create_async_engine("sqlite+aiosqlite:///filename") The URL passes through all arguments to the ``pysqlite`` driver, so all connection arguments are the same as they are for that of :ref:`pysqlite`. .. _aiosqlite_udfs: User-Defined Functions ---------------------- aiosqlite extends pysqlite to support async, so we can create our own user-defined functions (UDFs) in Python and use them directly in SQLite queries as described here: :ref:`pysqlite_udfs`. .. _aiosqlite_serializable: Serializable isolation / Savepoints / Transactional DDL (asyncio version) ------------------------------------------------------------------------- A newly revised version of this important section is now available at the top level of the SQLAlchemy SQLite documentation, in the section :ref:`sqlite_transactions`. .. _aiosqlite_pooling: Pooling Behavior ---------------- The SQLAlchemy ``aiosqlite`` DBAPI establishes the connection pool differently based on the kind of SQLite database that's requested: * When a ``:memory:`` SQLite database is specified, the dialect by default will use :class:`.StaticPool`. This pool maintains a single connection, so that all access to the engine use the same ``:memory:`` database. * When a file-based database is specified, the dialect will use :class:`.AsyncAdaptedQueuePool` as the source of connections. .. versionchanged:: 2.0.38 SQLite file database engines now use :class:`.AsyncAdaptedQueuePool` by default. Previously, :class:`.NullPool` were used. The :class:`.NullPool` class may be used by specifying it via the :paramref:`_sa.create_engine.poolclass` parameter. � N)�deque)�partial� )�SQLiteExecutionContext)�SQLiteDialect_pysqlite� )�pool)�util)�AdaptedConnection)�await_fallback)� await_onlyc @ s` e Zd ZdZdZdd� Zdd� Zddd �Zd d� Zdd � Z dd� Z dd� Zddd�Zdd� Z dS )�AsyncAdapt_aiosqlite_cursor)�_adapt_connection�_connection�description�await_�_rows� arraysize�rowcount� lastrowidFc C s4 || _ |j| _|j| _d| _d| _d | _t� | _d S )Nr ���)r r r r r r r r )�selfZadapt_connection� r �Y/home/agenciai/.local/lib/python3.9/site-packages/sqlalchemy/dialects/sqlite/aiosqlite.py�__init__p s z$AsyncAdapt_aiosqlite_cursor.__init__c C s | j �� d S �N)r �clear�r r r r �closey s z!AsyncAdapt_aiosqlite_cursor.closeNc C s� z�| � | j�� �}|d u r,| � |�|�� n| � |�||�� |jrt|j| _d | _| _| js�t| � |� � ��| _ nd | _|j| _|j| _| js�| � |�� � n|| _W n0 t y� } z| j�|� W Y d }~n d }~0 0 d S )Nr )r r �cursor�executer r r �server_sider �fetchallr r �_cursor� Exceptionr �_handle_exception)r � operation� parametersr# �errorr r r r | s$ z#AsyncAdapt_aiosqlite_cursor.executec C s� zJ| � | j�� �}| � |�||�� d | _|j| _|j| _| � |�� � W n0 tyz } z| j � |� W Y d }~n d }~0 0 d S r )r r r �executemanyr r r r r$ r r% )r r&