관리-도구
편집 파일: pg8000.cpython-38.pyc
U -?�f�H � @ s$ d Z ddlZddlZddlmZ ddlmZ ddlm Z ddlm Z ddlmZ dd lmZ dd lm Z ddlmZ ddlmZ dd lmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlm Z ddl!m"Z" G dd� de j#�Z$G dd� de j%�Z&G dd � d e&e j'�Z(G d!d"� d"e&�Z)G d#d$� d$e�Z*G d%d&� d&e�Z+G d'd(� d(e jj,�Z-G d)d*� d*e jj.�Z/G d+d,� d,e jj0�Z1G d-d.� d.e�Z2G d/d0� d0e�Z3G d1d2� d2e �Z4G d3d4� d4e j5�Z6G d5d6� d6e j7�Z8G d7d8� d8e j9�Z:G d9d:� d:e j;�Z<G d;d<� d<e j=�Z>G d=d>� d>e j?�Z@G d?d@� d@e jA�ZBG dAdB� dBe jC�ZDG dCdD� dDe�ZEG dEdF� dFee�ZFG dGdH� dHejG�ZHG dIdJ� dJejI�ZJe�K� ZLG dKdL� dLe�ZMG dMdN� dN�ZNG dOdP� dPe�ZOG dQdR� dRe�ZPG dSdT� dTe�ZQeQZRdS )Ua� .. dialect:: postgresql+pg8000 :name: pg8000 :dbapi: pg8000 :connectstring: postgresql+pg8000://user:password@host:port/dbname[?key=value&key=value...] :url: https://pypi.org/project/pg8000/ .. versionchanged:: 1.4 The pg8000 dialect has been updated for version 1.16.6 and higher, and is again part of SQLAlchemy's continuous integration with full feature support. .. _pg8000_unicode: Unicode ------- pg8000 will encode / decode string values between it and the server using the PostgreSQL ``client_encoding`` parameter; by default this is the value in the ``postgresql.conf`` file, which often defaults to ``SQL_ASCII``. Typically, this can be changed to ``utf-8``, as a more useful default:: #client_encoding = sql_ascii # actually, defaults to database # encoding client_encoding = utf8 The ``client_encoding`` can be overridden for a session by executing the SQL: SET CLIENT_ENCODING TO 'utf8'; SQLAlchemy will execute this SQL on all new connections based on the value passed to :func:`_sa.create_engine` using the ``client_encoding`` parameter:: engine = create_engine( "postgresql+pg8000://user:pass@host/dbname", client_encoding='utf8') .. _pg8000_ssl: SSL Connections --------------- pg8000 accepts a Python ``SSLContext`` object which may be specified using the :paramref:`_sa.create_engine.connect_args` dictionary:: import ssl ssl_context = ssl.create_default_context() engine = sa.create_engine( "postgresql+pg8000://scott:tiger@192.168.0.199/test", connect_args={"ssl_context": ssl_context}, ) If the server uses an automatically-generated certificate that is self-signed or does not match the host name (as seen from the client), it may also be necessary to disable hostname checking:: import ssl ssl_context = ssl.create_default_context() ssl_context.check_hostname = False ssl_context.verify_mode = ssl.CERT_NONE engine = sa.create_engine( "postgresql+pg8000://scott:tiger@192.168.0.199/test", connect_args={"ssl_context": ssl_context}, ) .. _pg8000_isolation_level: pg8000 Transaction Isolation Level ------------------------------------- The pg8000 dialect offers the same isolation level settings as that of the :ref:`psycopg2 <psycopg2_isolation_level>` dialect: * ``READ COMMITTED`` * ``READ UNCOMMITTED`` * ``REPEATABLE READ`` * ``SERIALIZABLE`` * ``AUTOCOMMIT`` .. seealso:: :ref:`postgresql_isolation_level` :ref:`psycopg2_isolation_level` � N� )�ranges)�ARRAY)�_DECIMAL_TYPES)�_FLOAT_TYPES)� _INT_TYPES)�ENUM��INTERVAL)� PGCompiler)� PGDialect)�PGExecutionContext)�PGIdentifierPreparer)�JSON)�JSONB)�JSONPathType)�_SpaceVector)� OIDVECTOR)�CITEXT� )�exc)�util)� processors)�sqltypes)�quoted_namec @ s e Zd ZdZdS )� _PGStringTN��__name__� __module__�__qualname__�render_bind_cast� r! r! �U/opt/hc_python/lib64/python3.8/site-packages/sqlalchemy/dialects/postgresql/pg8000.pyr y s r c @ s e Zd ZdZdd� ZdS )� _PGNumericTc C sv | j rB|tkrt�tj| j�S |tks.|tkr2d S t � d| ��n0|tkrNd S |tks^|tkrdtjS t � d| ��d S )NzUnknown PG numeric type: %d)Z asdecimalr r Zto_decimal_processor_factory�decimal�DecimalZ_effective_decimal_return_scaler r r ZInvalidRequestErrorZto_float��self�dialect�coltyper! r! r"