관리-도구
편집 파일: psycopg.cpython-38.pyc
U -?�f�Z � @ s& d Z ddlmZ ddlmZ ddlZddlZddlmZ ddlm Z ddl mZ dd lm Z dd lmZ ddlmZ ddlmZ dd lmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddl mZ ddl mZ ddlmZ ddlmZ ddl m!Z! ddl m"Z" e �r.ddlm#Z# ddl$m%Z% e�&d�Z'G dd� dej(�Z)G dd � d e�Z*G d!d"� d"e�Z+G d#d$� d$e�Z,G d%d&� d&ejj-�Z.G d'd(� d(ejj/�Z0G d)d*� d*e�Z1G d+d,� d,e�Z2G d-d.� d.ej3�Z4G d/d0� d0ej5�Z6G d1d2� d2ej7�Z8G d3d4� d4ej9�Z:G d5d6� d6ej;�Z<G d7d8� d8ej=�Z>G d9d:� d:ej?�Z@G d;d<� d<ejA�ZBG d=d>� d>ejC�ZDG d?d@� d@ejE�ZFG dAdB� dBe�ZGG dCdD� dDe�ZHG dEdF� dFe�ZIdGdH� ZJG dIdJ� dJe �ZKG dKdL� dL�ZLG dMdN� dNeL�ZMG dOdP� dPe�ZNG dQdR� dReN�ZOG dSdT� dT�ZPG dUdV� dVeK�ZQeKZReQZSdS )WaH .. dialect:: postgresql+psycopg :name: psycopg (a.k.a. psycopg 3) :dbapi: psycopg :connectstring: postgresql+psycopg://user:password@host:port/dbname[?key=value&key=value...] :url: https://pypi.org/project/psycopg/ ``psycopg`` is the package and module name for version 3 of the ``psycopg`` database driver, formerly known as ``psycopg2``. This driver is different enough from its ``psycopg2`` predecessor that SQLAlchemy supports it via a totally separate dialect; support for ``psycopg2`` is expected to remain for as long as that package continues to function for modern Python versions, and also remains the default dialect for the ``postgresql://`` dialect series. The SQLAlchemy ``psycopg`` dialect provides both a sync and an async implementation under the same dialect name. The proper version is selected depending on how the engine is created: * calling :func:`_sa.create_engine` with ``postgresql+psycopg://...`` will automatically select the sync version, e.g.:: from sqlalchemy import create_engine sync_engine = create_engine("postgresql+psycopg://scott:tiger@localhost/test") * calling :func:`_asyncio.create_async_engine` with ``postgresql+psycopg://...`` will automatically select the async version, e.g.:: from sqlalchemy.ext.asyncio import create_async_engine asyncio_engine = create_async_engine("postgresql+psycopg://scott:tiger@localhost/test") The asyncio version of the dialect may also be specified explicitly using the ``psycopg_async`` suffix, as:: from sqlalchemy.ext.asyncio import create_async_engine asyncio_engine = create_async_engine("postgresql+psycopg_async://scott:tiger@localhost/test") .. seealso:: :ref:`postgresql_psycopg2` - The SQLAlchemy ``psycopg`` dialect shares most of its behavior with the ``psycopg2`` dialect. Further documentation is available there. Using a different Cursor class ------------------------------ One of the differences between ``psycopg`` and the older ``psycopg2`` is how bound parameters are handled: ``psycopg2`` would bind them client side, while ``psycopg`` by default will bind them server side. It's possible to configure ``psycopg`` to do client side binding by specifying the ``cursor_factory`` to be ``ClientCursor`` when creating the engine:: from psycopg import ClientCursor client_side_engine = create_engine( "postgresql+psycopg://...", connect_args={"cursor_factory": ClientCursor}, ) Similarly when using an async engine the ``AsyncClientCursor`` can be specified:: from psycopg import AsyncClientCursor client_side_engine = create_async_engine( "postgresql+psycopg://...", connect_args={"cursor_factory": AsyncClientCursor}, ) .. seealso:: `Client-side-binding cursors <https://www.psycopg.org/psycopg3/docs/advanced/cursors.html#client-side-binding-cursors>`_ � )�annotations)�dequeN)�cast)� TYPE_CHECKING� )�ranges)�_PGDialect_common_psycopg)�"_PGExecutionContext_common_psycopg)�INTERVAL)� PGCompiler)�PGIdentifierPreparer)� REGCONFIG)�JSON)�JSONB)�JSONPathType)�CITEXT� )�pool)�util)�AdaptedConnection)�sqltypes)�await_fallback)� await_only)�Iterable)�AsyncConnectionzsqlalchemy.dialects.postgresqlc @ s e Zd ZdZdS )� _PGStringTN��__name__� __module__�__qualname__�render_bind_cast� r! r! �V/opt/hc_python/lib64/python3.8/site-packages/sqlalchemy/dialects/postgresql/psycopg.pyr x s r c @ s e Zd ZdZdS )�_PGREGCONFIGTNr r! r! r! r"