%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/postgresql/
Upload File :
Create Path :
Current File : //opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/postgresql/psycopg2.pyc

�
��4]c@@s�dZddlmZddlZddlZddlZddlmZddlmZddlm	Z	ddlm
Z
dd	lmZdd
lmZddlm
Z
ddlmZdd
lmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZydd
lmZ Wne!k
r�e"Z nXej#d�Z$dej%fd��YZ&de
fd��YZ'defd��YZ(defd ��YZ)d!efd"��YZ*d#efd$��YZ+ej,�Z-d%e
fd&��YZ.d'efd(��YZ/d)efd*��YZ0d+efd,��YZ1e1Z2dS(-s�9
.. dialect:: postgresql+psycopg2
    :name: psycopg2
    :dbapi: psycopg2
    :connectstring: postgresql+psycopg2://user:password@host:port/dbname[?key=value&key=value...]
    :url: http://pypi.python.org/pypi/psycopg2/

psycopg2 Connect Arguments
-----------------------------------

psycopg2-specific keyword arguments which are accepted by
:func:`.create_engine()` are:

* ``server_side_cursors``: Enable the usage of "server side cursors" for SQL
  statements which support this feature. What this essentially means from a
  psycopg2 point of view is that the cursor is created using a name, e.g.
  ``connection.cursor('some name')``, which has the effect that result rows
  are not immediately pre-fetched and buffered after statement execution, but
  are instead left on the server and only retrieved as needed. SQLAlchemy's
  :class:`~sqlalchemy.engine.ResultProxy` uses special row-buffering
  behavior when this feature is enabled, such that groups of 100 rows at a
  time are fetched over the wire to reduce conversational overhead.
  Note that the :paramref:`.Connection.execution_options.stream_results`
  execution option is a more targeted
  way of enabling this mode on a per-execution basis.

* ``use_native_unicode``: Enable the usage of Psycopg2 "native unicode" mode
  per connection.  True by default.

  .. seealso::

    :ref:`psycopg2_disable_native_unicode`

* ``isolation_level``: This option, available for all PostgreSQL dialects,
  includes the ``AUTOCOMMIT`` isolation level when using the psycopg2
  dialect.

  .. seealso::

    :ref:`psycopg2_isolation_level`

* ``client_encoding``: sets the client encoding in a libpq-agnostic way,
  using psycopg2's ``set_client_encoding()`` method.

  .. seealso::

    :ref:`psycopg2_unicode`

* ``use_batch_mode``: This flag allows ``psycopg2.extras.execute_batch``
  for ``cursor.executemany()`` calls performed by the :class:`.Engine`.
  It is currently experimental but
  may well become True by default as it is critical for executemany
  performance.

  .. seealso::

    :ref:`psycopg2_batch_mode`

Unix Domain Connections
------------------------

psycopg2 supports connecting via Unix domain connections.   When the ``host``
portion of the URL is omitted, SQLAlchemy passes ``None`` to psycopg2,
which specifies Unix-domain communication rather than TCP/IP communication::

    create_engine("postgresql+psycopg2://user:password@/dbname")

By default, the socket file used is to connect to a Unix-domain socket
in ``/tmp``, or whatever socket directory was specified when PostgreSQL
was built.  This value can be overridden by passing a pathname to psycopg2,
using ``host`` as an additional keyword argument::

    create_engine("postgresql+psycopg2://user:password@/dbname?host=/var/lib/postgresql")

.. seealso::

    `PQconnectdbParams \
    <http://www.postgresql.org/docs/9.1/static/libpq-connect.html#LIBPQ-PQCONNECTDBPARAMS>`_

Empty DSN Connections / Environment Variable Connections
---------------------------------------------------------

The psycopg2 DBAPI can connect to PostgreSQL by passing an empty DSN to the
libpq client library, which by default indicates to connect to a localhost
PostgreSQL database that is open for "trust" connections.  This behavior can be
further tailored using a particular set of environment variables which are
prefixed with ``PG_...``, which are  consumed by ``libpq`` to take the place of
any or all elements of the connection string.

For this form, the URL can be passed without any elements other than the
initial scheme::

    engine = create_engine('postgresql+psycopg2://')

In the above form, a blank "dsn" string is passed to the ``psycopg2.connect()``
function which in turn represents an empty DSN passed to libpq.

.. versionadded:: 1.3.2 support for parameter-less connections with psycopg2.

.. seealso::

    `Environment Variables\
    <https://www.postgresql.org/docs/current/libpq-envars.html>`_ -
    PostgreSQL documentation on how to use ``PG_...``
    environment variables for connections.

.. _psycopg2_execution_options:

Per-Statement/Connection Execution Options
-------------------------------------------

The following DBAPI-specific options are respected when used with
:meth:`.Connection.execution_options`, :meth:`.Executable.execution_options`,
:meth:`.Query.execution_options`, in addition to those not specific to DBAPIs:

* ``isolation_level`` - Set the transaction isolation level for the lifespan
  of a :class:`.Connection` (can only be set on a connection, not a statement
  or query).   See :ref:`psycopg2_isolation_level`.

* ``stream_results`` - Enable or disable usage of psycopg2 server side
  cursors - this feature makes use of "named" cursors in combination with
  special result handling methods so that result rows are not fully buffered.
  If ``None`` or not set, the ``server_side_cursors`` option of the
  :class:`.Engine` is used.

* ``max_row_buffer`` - when using ``stream_results``, an integer value that
  specifies the maximum number of rows to buffer at a time.  This is
  interpreted by the :class:`.BufferedRowResultProxy`, and if omitted the
  buffer will grow to ultimately store 1000 rows at a time.

  .. versionadded:: 1.0.6

.. _psycopg2_batch_mode:

Psycopg2 Batch Mode (Fast Execution)
------------------------------------

Modern versions of psycopg2 include a feature known as
`Fast Execution Helpers \
<http://initd.org/psycopg/docs/extras.html#fast-execution-helpers>`_,
which have been shown in benchmarking to improve psycopg2's executemany()
performance with INSERTS by multiple orders of magnitude.   SQLAlchemy
allows this extension to be used for all ``executemany()`` style calls
invoked by an :class:`.Engine` when used with :ref:`multiple parameter sets <execute_multiple>`,
by adding the ``use_batch_mode`` flag to :func:`.create_engine`::

    engine = create_engine(
        "postgresql+psycopg2://scott:tiger@host/dbname",
        use_batch_mode=True)

Batch mode is considered to be **experimental** at this time, however may
be enabled by default in a future release.

.. seealso::

    :ref:`execute_multiple` - demonstrates how to use DBAPI ``executemany()``
    with the :class:`.Connection` object.

.. versionadded:: 1.2.0



.. _psycopg2_unicode:

Unicode with Psycopg2
----------------------

By default, the psycopg2 driver uses the ``psycopg2.extensions.UNICODE``
extension, such that the DBAPI receives and returns all strings as Python
Unicode objects directly - SQLAlchemy passes these values through without
change.   Psycopg2 here will encode/decode string values based on the
current "client encoding" setting; by default this is the value in
the ``postgresql.conf`` file, which often defaults to ``SQL_ASCII``.
Typically, this can be changed to ``utf8``, as a more useful default::

    # postgresql.conf file

    # client_encoding = sql_ascii # actually, defaults to database
                                 # encoding
    client_encoding = utf8

A second way to affect the client encoding is to set it within Psycopg2
locally.   SQLAlchemy will call psycopg2's
:meth:`psycopg2:connection.set_client_encoding` method
on all new connections based on the value passed to
:func:`.create_engine` using the ``client_encoding`` parameter::

    # set_client_encoding() setting;
    # works for *all* PostgreSQL versions
    engine = create_engine("postgresql://user:pass@host/dbname",
                           client_encoding='utf8')

This overrides the encoding specified in the PostgreSQL client configuration.
When using the parameter in this way, the psycopg2 driver emits
``SET client_encoding TO 'utf8'`` on the connection explicitly, and works
in all PostgreSQL versions.

Note that the ``client_encoding`` setting as passed to :func:`.create_engine`
is **not the same** as the more recently added ``client_encoding`` parameter
now supported by libpq directly.   This is enabled when ``client_encoding``
is passed directly to ``psycopg2.connect()``, and from SQLAlchemy is passed
using the :paramref:`.create_engine.connect_args` parameter::

    engine = create_engine(
        "postgresql://user:pass@host/dbname",
        connect_args={'client_encoding': 'utf8'})

    # using the query string is equivalent
    engine = create_engine("postgresql://user:pass@host/dbname?client_encoding=utf8")

The above parameter was only added to libpq as of version 9.1 of PostgreSQL,
so using the previous method is better for cross-version support.

.. _psycopg2_disable_native_unicode:

Disabling Native Unicode
^^^^^^^^^^^^^^^^^^^^^^^^

SQLAlchemy can also be instructed to skip the usage of the psycopg2
``UNICODE`` extension and to instead utilize its own unicode encode/decode
services, which are normally reserved only for those DBAPIs that don't
fully support unicode directly.  Passing ``use_native_unicode=False`` to
:func:`.create_engine` will disable usage of ``psycopg2.extensions.UNICODE``.
SQLAlchemy will instead encode data itself into Python bytestrings on the way
in and coerce from bytes on the way back,
using the value of the :func:`.create_engine` ``encoding`` parameter, which
defaults to ``utf-8``.
SQLAlchemy's own unicode encode/decode functionality is steadily becoming
obsolete as most DBAPIs now support unicode fully.

Bound Parameter Styles
----------------------

The default parameter style for the psycopg2 dialect is "pyformat", where
SQL is rendered using ``%(paramname)s`` style.   This format has the limitation
that it does not accommodate the unusual case of parameter names that
actually contain percent or parenthesis symbols; as SQLAlchemy in many cases
generates bound parameter names based on the name of a column, the presence
of these characters in a column name can lead to problems.

There are two solutions to the issue of a :class:`.schema.Column` that contains
one of these characters in its name.  One is to specify the
:paramref:`.schema.Column.key` for columns that have such names::

    measurement = Table('measurement', metadata,
        Column('Size (meters)', Integer, key='size_meters')
    )

Above, an INSERT statement such as ``measurement.insert()`` will use
``size_meters`` as the parameter name, and a SQL expression such as
``measurement.c.size_meters > 10`` will derive the bound parameter name
from the ``size_meters`` key as well.

.. versionchanged:: 1.0.0 - SQL expressions will use :attr:`.Column.key`
   as the source of naming when anonymous bound parameters are created
   in SQL expressions; previously, this behavior only applied to
   :meth:`.Table.insert` and :meth:`.Table.update` parameter names.

The other solution is to use a positional format; psycopg2 allows use of the
"format" paramstyle, which can be passed to
:paramref:`.create_engine.paramstyle`::

    engine = create_engine(
        'postgresql://scott:tiger@localhost:5432/test', paramstyle='format')

With the above engine, instead of a statement like::

    INSERT INTO measurement ("Size (meters)") VALUES (%(Size (meters))s)
    {'Size (meters)': 1}

we instead see::

    INSERT INTO measurement ("Size (meters)") VALUES (%s)
    (1, )

Where above, the dictionary style is converted into a tuple with positional
style.


Transactions
------------

The psycopg2 dialect fully supports SAVEPOINT and two-phase commit operations.

.. _psycopg2_isolation_level:

Psycopg2 Transaction Isolation Level
-------------------------------------

As discussed in :ref:`postgresql_isolation_level`,
all PostgreSQL dialects support setting of transaction isolation level
both via the ``isolation_level`` parameter passed to :func:`.create_engine`,
as well as the ``isolation_level`` argument used by
:meth:`.Connection.execution_options`.  When using the psycopg2 dialect, these
options make use of psycopg2's ``set_isolation_level()`` connection method,
rather than emitting a PostgreSQL directive; this is because psycopg2's
API-level setting is always emitted at the start of each transaction in any
case.

The psycopg2 dialect supports these constants for isolation level:

* ``READ COMMITTED``
* ``READ UNCOMMITTED``
* ``REPEATABLE READ``
* ``SERIALIZABLE``
* ``AUTOCOMMIT``

.. seealso::

    :ref:`postgresql_isolation_level`

    :ref:`pg8000_isolation_level`


NOTICE logging
---------------

The psycopg2 dialect will log PostgreSQL NOTICE messages
via the ``sqlalchemy.dialects.postgresql`` logger.  When this logger
is set to the ``logging.INFO`` level, notice messages will be logged::

    import logging

    logging.getLogger('sqlalchemy.dialects.postgresql').setLevel(logging.INFO)

Above, it is assumed that logging is configured externally.  If this is not
the case, configuration such as ``logging.basicConfig()`` must be utilized::

    import logging

    logging.basicConfig()   # log messages to stdout
    logging.getLogger('sqlalchemy.dialects.postgresql').setLevel(logging.INFO)

.. seealso::

    `Logging HOWTO <https://docs.python.org/3/howto/logging.html>`_ - on the python.org website

.. _psycopg2_hstore:

HSTORE type
------------

The ``psycopg2`` DBAPI includes an extension to natively handle marshalling of
the HSTORE type.   The SQLAlchemy psycopg2 dialect will enable this extension
by default when psycopg2 version 2.4 or greater is used, and
it is detected that the target database has the HSTORE type set up for use.
In other words, when the dialect makes the first
connection, a sequence like the following is performed:

1. Request the available HSTORE oids using
   ``psycopg2.extras.HstoreAdapter.get_oids()``.
   If this function returns a list of HSTORE identifiers, we then determine
   that the ``HSTORE`` extension is present.
   This function is **skipped** if the version of psycopg2 installed is
   less than version 2.4.

2. If the ``use_native_hstore`` flag is at its default of ``True``, and
   we've detected that ``HSTORE`` oids are available, the
   ``psycopg2.extensions.register_hstore()`` extension is invoked for all
   connections.

The ``register_hstore()`` extension has the effect of **all Python
dictionaries being accepted as parameters regardless of the type of target
column in SQL**. The dictionaries are converted by this extension into a
textual HSTORE expression.  If this behavior is not desired, disable the
use of the hstore extension by setting ``use_native_hstore`` to ``False`` as
follows::

    engine = create_engine("postgresql+psycopg2://scott:tiger@localhost/test",
                use_native_hstore=False)

The ``HSTORE`` type is **still supported** when the
``psycopg2.extensions.register_hstore()`` extension is not used.  It merely
means that the coercion between Python dictionaries and the HSTORE
string format, on both the parameter side and the result side, will take
place within SQLAlchemy's own marshalling logic, and not that of ``psycopg2``
which may be more performant.

i(tabsolute_importNi(t_DECIMAL_TYPES(t_FLOAT_TYPES(t
_INT_TYPES(tENUM(t
PGCompiler(t	PGDialect(tPGExecutionContext(tPGIdentifierPreparer(tUUID(tHSTORE(tJSON(tJSONBi(texc(t
processors(ttypes(tutil(tresult(tcollections_abcssqlalchemy.dialects.postgresqlt
_PGNumericcB@seZd�Zd�ZRS(cC@sdS(N(tNone(tselftdialect((sZ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/postgresql/psycopg2.pytbind_processor�scC@s�|jr]|tkr+tjtj|j�S|tksC|tkrGdSt
jd|��nB|tkrmdS|tks�|tkr�tjSt
jd|��dS(NsUnknown PG numeric type: %d(
t	asdecimalRRtto_decimal_processor_factorytdecimaltDecimalt_effective_decimal_return_scaleRRRR
tInvalidRequestErrortto_float(RRtcoltype((sZ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/postgresql/psycopg2.pytresult_processor�s	(t__name__t
__module__RR (((sZ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/postgresql/psycopg2.pyR�s	t_PGEnumcB@seZd�ZRS(cC@s=tjr$|jtkr$d|_ntt|�j||�S(Nt
force_nocheck(Rtpy2kt_expect_unicodetTruetsuperR#R (RRR((sZ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/postgresql/psycopg2.pyR �s
(R!R"R (((sZ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/postgresql/psycopg2.pyR#�st	_PGHStorecB@seZd�Zd�ZRS(cC@s'|jr
dStt|�j|�SdS(N(t_has_native_hstoreRR(R)R(RR((sZ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/postgresql/psycopg2.pyR�s	cC@s*|jr
dStt|�j||�SdS(N(R*RR(R)R (RRR((sZ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/postgresql/psycopg2.pyR �s	(R!R"RR (((sZ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/postgresql/psycopg2.pyR)�s	t_PGJSONcB@seZd�ZRS(cC@s*|jr
dStt|�j||�SdS(N(t_has_native_jsonRR(R+R (RRR((sZ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/postgresql/psycopg2.pyR �s	(R!R"R (((sZ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/postgresql/psycopg2.pyR+�st_PGJSONBcB@seZd�ZRS(cC@s*|jr
dStt|�j||�SdS(N(t_has_native_jsonbRR(R-R (RRR((sZ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/postgresql/psycopg2.pyR �s	(R!R"R (((sZ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/postgresql/psycopg2.pyR-�st_PGUUIDcB@seZd�Zd�ZRS(cC@s$|jr |jr d�}|SdS(NcS@s|dk	rt|�}n|S(N(Rt_python_UUID(tvalue((sZ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/postgresql/psycopg2.pytprocess�s(tas_uuidtuse_native_uuid(RRR2((sZ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/postgresql/psycopg2.pyR�s	cC@s$|jr |jr d�}|SdS(NcS@s|dk	rt|�}n|S(N(Rtstr(R1((sZ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/postgresql/psycopg2.pyR2�s(R3R4(RRRR2((sZ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/postgresql/psycopg2.pyR �s	(R!R"RR (((sZ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/postgresql/psycopg2.pyR/�s	
tPGExecutionContext_psycopg2cB@s#eZd�Zd�Zd�ZRS(cC@s=dtt|��dtt��df}|jj|�S(Nsc_%s_%si(thextidt_server_side_idt_dbapi_connectiontcursor(Rtident((sZ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/postgresql/psycopg2.pytcreate_server_side_cursor	s-cC@s7|j|j�|jr&tj|�Stj|�SdS(N(t_log_noticesR;t_is_server_sidet_resulttBufferedRowResultProxytResultProxy(R((sZ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/postgresql/psycopg2.pytget_result_proxys	
cC@se|jjs&t|jjtj�r*dSx'|jjD]}tj|j��q7Wg|jj(dS(N(t
connectiontnoticest
isinstanceRtIterabletloggertinfotrstrip(RR;tnotice((sZ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/postgresql/psycopg2.pyR>s(R!R"R=RCR>(((sZ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/postgresql/psycopg2.pyR6s		tPGCompiler_psycopg2cB@seZRS((R!R"(((sZ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/postgresql/psycopg2.pyRL)stPGIdentifierPreparer_psycopg2cB@seZRS((R!R"(((sZ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/postgresql/psycopg2.pyRM-stPGDialect_psycopg2cB@s�eZdZejreZneZdZ	eZ
eZe
ZeZdZeddddddd
ddd�ZeZeZeZejjd
ejfg�Zejejieej6e e!6e ej"6e#e$6e%e&6e%ej&6e'e(6e)e*6�Zeed eeed�Z,d�Z-e.d��Z/e.d��Z0e.d��Z1ej2d��Z3d�Z4d�Z5d d�Z6ej7d��Z8d�Z9d�Z:RS(!tpsycopg2tpyformatitnative_jsoniitnative_jsonbitsane_multi_rowcounti	t	array_oidithstore_adaptertuse_native_unicodec	K@s�tj||�||_||_||_||_||_||_||_|j	r�t
|j	d�r�tjd|j	j
�}|r�td�|jddd�D��|_q�ndS(Nt__version__s(\d+)\.(\d+)(?:\.(\d+))?cs@s'|]}|dk	rt|�VqdS(N(Rtint(t.0tx((sZ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/postgresql/psycopg2.pys	<genexpr>tsiii(Rt__init__tserver_side_cursorsRVtuse_native_hstoreR4tsupports_unicode_bindstclient_encodingtpsycopg2_batch_modetdbapithasattrtretmatchRWttupletgrouptpsycopg2_version(	RR\RVR_R]R4tuse_batch_modetkwargstm((sZ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/postgresql/psycopg2.pyR[^s
							cC@s�tt|�j|�|jo4|j|j�dk	|_|j|j	dk|_
|j|j	dk|_|j|j	dko�|j|_
dS(NRQRRRS(R(RNt
initializeR]t_hstore_oidsRDRR*RgtFEATURE_VERSION_MAPR,R.R`tsupports_sane_multi_rowcount(RRD((sZ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/postgresql/psycopg2.pyRkws	cC@sddl}|S(Ni(RO(tclsRO((sZ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/postgresql/psycopg2.pyRa�scC@sddlm}|S(Ni(t
extensions(RORp(RoRp((sZ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/postgresql/psycopg2.pyt_psycopg2_extensions�scC@sddlm}|S(Ni(textras(RORr(RoRr((sZ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/postgresql/psycopg2.pyt_psycopg2_extras�scC@sB|j�}i|jd6|jd6|jd6|jd6|jd6S(Nt
AUTOCOMMITsREAD COMMITTEDsREAD UNCOMMITTEDsREPEATABLE READtSERIALIZABLE(RqtISOLATION_LEVEL_AUTOCOMMITtISOLATION_LEVEL_READ_COMMITTEDt ISOLATION_LEVEL_READ_UNCOMMITTEDtISOLATION_LEVEL_REPEATABLE_READtISOLATION_LEVEL_SERIALIZABLE(RRp((sZ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/postgresql/psycopg2.pyt_isolation_lookup�s



cC@smy|j|jdd�}Wn<tk
r[tjd||jdj|j�f��nX|j|�dS(Nt_t sLInvalid value '%s' for isolation_level. Valid isolation levels for %s are %ss, (R{treplacetKeyErrorR
t
ArgumentErrortnametjointset_isolation_level(RRDtlevel((sZ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/postgresql/psycopg2.pyR��s
&c@se�j���j��g��jdk	rL�fd�}�j|�n�jdk	rz�fd�}�j|�n�jr��jr��fd�}�j|�n�jr��jr��fd�}�j|�n�jr�j	r��fd�}�j|�n�jrD�j
rD��fd�}�j|�n�r]�fd�}|SdSdS(Nc@s|j�j�dS(N(tset_client_encodingR_(tconn(R(sZ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/postgresql/psycopg2.pyt
on_connect�sc@s�j|�j�dS(N(R�tisolation_level(R�(R(sZ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/postgresql/psycopg2.pyR��sc@s�jd|�dS(N(t
register_uuidR(R�(Rr(sZ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/postgresql/psycopg2.pyR��sc@s*�j�j|��j�j|�dS(N(t
register_typetUNICODEtUNICODEARRAY(R�(Rp(sZ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/postgresql/psycopg2.pyR��sc@s��j|�}|dk	r�|\}}i|d6}tjrJt|d<n�j�jdkrm||d<n�j||�ndS(NtoidtunicodeRT(RlRRR%R'RgRmtregister_hstore(R�thstore_oidsR�RTtkw(RrR(sZ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/postgresql/psycopg2.pyR��s
	

c@sH�jr"�j|d�j�n�jrD�j|d�j�ndS(Ntloads(R,tregister_default_jsont_json_deserializerR.tregister_default_jsonb(R�(RrR(sZ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/postgresql/psycopg2.pyR��s		c@sx�D]}||�qWdS(N((R�tfn(tfns(sZ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/postgresql/psycopg2.pyR��s
(RsRqR_RtappendR�RaR4RVR]R�(RR�((RpRrR�RsZ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/postgresql/psycopg2.pyR��s2
cC@s?|jr+|j�}|j|||�n|j||�dS(N(R`Rst
execute_batchtexecutemany(RR;t	statementt
parameterstcontextRr((sZ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/postgresql/psycopg2.pytdo_executemanys	cC@s\|j|jdkrX|j�}|jj|�}|dk	rX|drX|dd!SndS(NRUii(RgRmRst
HstoreAdaptertget_oidsR(RR�Rrtoids((sZ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/postgresql/psycopg2.pyRlscC@s�|jdd�}|rUd|kr;t|d�|d<n|j|j�g|fS|jrx|j|j�g|fSdg|fSdS(Ntusernametusertportt(ttranslate_connect_argsRXtupdatetquery(Rturltopts((sZ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/postgresql/psycopg2.pytcreate_connect_argss
	
c
C@s�t||jj�r�t|dt�r+tSt|�jd�d}xgdddddd	d
ddd
dddg
D]5}|j|�}|dkrrd|| krrtSqrWntS(Ntcloseds
isterminating connectionsclosed the connectionsconnection not opens"could not receive data from serverscould not send data to serversconnection already closedscursor already closeds!losed the connection unexpectedlys'connection has been closed unexpectedlys&SSL SYSCALL error: Bad file descriptorsSSL SYSCALL error: EOF detecteds.SSL error: decryption failed or bad record macs&SSL SYSCALL error: Operation timed outt"(	RFRatErrortgetattrtFalseR'R5t	partitiontfind(RteRDR;tstr_etmsgtidx((sZ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/postgresql/psycopg2.pyt
is_disconnect"s,
(ii(ii(iii(iii	(iii(iiN(;R!R"tdriverRR%R�tsupports_unicode_statementsR'tsupports_server_side_cursorstdefault_paramstyleRnR6texecution_ctx_clsRLtstatement_compilerRMtpreparerRgtdictRmR*R,R.Rtengine_config_typestuniontasbooltupdate_copytcolspecsRtsqltypestNumericR#RtEnumR)R
R+RR-RR/R	RR[RktclassmethodRaRqRstmemoized_propertyR{R�R�R�tmemoized_instancemethodRlR�R�(((sZ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/postgresql/psycopg2.pyRN1sb				



			L		(3t__doc__t
__future__RRtloggingRctbaseRRRRRRRRR	thstoreR
tjsonRRR�R
RRR�RtengineRR@RtuuidR0tImportErrorRt	getLoggerRHR�RR#R)R+R-R/tcounterR9R6RLRMRNR(((sZ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/postgresql/psycopg2.pyt<module>�sP

!�

Zerion Mini Shell 1.0