관리-도구
편집 파일: pg8000.cpython-37.pyc
B ��4]�% � @ sp d Z ddlZddlZddlmZ ddlmZ ddlmZ ddlmZ ddlmZ dd lm Z dd lm Z ddlmZ ddlm Z d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ yddlmZ W n ek r� dZY nX G dd� dej�ZG dd� de�ZG dd� de �ZG dd� de�ZG dd� de �ZG dd� de�ZG dd � d e �Z G d!d"� d"e�Z!e!Z"dS )#a� .. dialect:: postgresql+pg8000 :name: pg8000 :dbapi: pg8000 :connectstring: postgresql+pg8000://user:password@host:port/dbname[?key=value&key=value...] :url: https://pythonhosted.org/pg8000/ .. note:: The pg8000 dialect is **not tested as part of SQLAlchemy's continuous integration** and may have unresolved issues. The recommended PostgreSQL dialect is psycopg2. .. _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:`.create_engine` using the ``client_encoding`` parameter:: engine = create_engine( "postgresql+pg8000://user:pass@host/dbname", client_encoding='utf8') .. _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`` .. versionadded:: 0.9.5 support for AUTOCOMMIT isolation level when using pg8000. .. seealso:: :ref:`postgresql_isolation_level` :ref:`psycopg2_isolation_level` � N� )�_DECIMAL_TYPES)�_FLOAT_TYPES)� _INT_TYPES)� PGCompiler)� PGDialect)�PGExecutionContext)�PGIdentifierPreparer)�UUID)�JSON� )�exc)� processors)�types)�util)�quoted_namec @ s e Zd Zdd� ZdS )� _PGNumericc 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�decimalZDecimalZ_effective_decimal_return_scaler r r ZInvalidRequestErrorZto_float)�self�dialect�coltype� r �X/opt/alt/python37/lib64/python3.7/site-packages/sqlalchemy/dialects/postgresql/pg8000.py�result_processor` s z_PGNumeric.result_processorN)�__name__� __module__�__qualname__r r r r r r _ s r c @ s e Zd Zdd� ZdS )�_PGNumericNoBindc C s d S )Nr )r r r r r �bind_processorz s z_PGNumericNoBind.bind_processorN)r r r r r r r r r y s r c s e Zd Z� fdd�Z� ZS )�_PGJSONc s$ |j dkrd S tt| ��||�S d S )N)r � r )�_dbapi_version�superr r )r r r )� __class__r r r s z_PGJSON.result_processor)r r r r � __classcell__r r )r# r r ~ s r c @ s e Zd Zdd� Zdd� ZdS )�_PGUUIDc C s | j sdd� }|S d S )Nc S s | d k rt | �} | S )N)�_python_UUID)�valuer r r �process� s z'_PGUUID.bind_processor.<locals>.process)�as_uuid)r r r( r r r r � s z_PGUUID.bind_processorc C s | j sdd� }|S d S )Nc S s | d k rt | �} | S )N)�str)r'