Hacked By AnonymousFox
�
�܋f�% � �� � 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 ddlmZ n
# e$ r dZY nw xY w G d� dej � � Z G d� de� � Z G d� de
� � Z G d� de� � Z G d� de � � Z G d� de� � Z G d� d e
� � Z G 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:`_sa.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 � � e Zd Zd� ZdS )�
_PGNumericc �@ � | j rX|t v r$t j t j | j � � S |t v s |t v rd S t j
d|z � � �|t v rd S |t v s |t v rt j S t j
d|z � � �)NzUnknown PG numeric type: %d)� asdecimalr r �to_decimal_processor_factory�decimal�Decimal�_effective_decimal_return_scaler r r �InvalidRequestError�to_float)�self�dialect�coltypes �\/opt/cloudlinux/venv/lib64/python3.11/site-packages/sqlalchemy/dialects/postgresql/pg8000.py�result_processorz_PGNumeric.result_processor` s� � ��>� ��,�&�&�!�>��O�T�%I�� � � �N�*�*�g��.C�.C��t��-�1�G�;�� � � �,�&�&��t��N�*�*�g��.C�.C�!�*�*��-�1�G�;�� � � N)�__name__�
__module__�__qualname__r! � r"