$87 GRAYBYTE WORDPRESS FILE MANAGER $28

SERVER : vnpttt-amd7f72-h1.vietnix.vn #1 SMP Fri May 24 12:42:50 UTC 2024
SERVER IP : 103.200.23.149 | ADMIN IP 216.73.216.22
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : NONE

/usr/lib64/python2.7/site-packages/sqlalchemy/dialects/postgresql/

HOME
Current File : /usr/lib64/python2.7/site-packages/sqlalchemy/dialects/postgresql//pypostgresql.py
# dialects/postgresql/pypostgresql.py
# Copyright (C) 2005-2024 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: https://www.opensource.org/licenses/mit-license.php
"""
.. dialect:: postgresql+pypostgresql
    :name: py-postgresql
    :dbapi: pypostgresql
    :connectstring: postgresql+pypostgresql://user:password@host:port/dbname[?key=value&key=value...]
    :url: https://python.projects.pgfoundry.org/

.. note::

    The pypostgresql dialect is **not tested as part of SQLAlchemy's continuous
    integration** and may have unresolved issues.  The recommended PostgreSQL
    driver is psycopg2.

.. deprecated:: 1.4 The py-postgresql DBAPI is deprecated and will be removed
   in a future version. This DBAPI is superseded by the external
    version available at external-dialect_. Please use the external version or
    one of the supported DBAPIs to connect to PostgreSQL.

.. TODO update link
.. _external-dialect: https://github.com/PyGreSQL

"""  # noqa

from .base import PGDialect
from .base import PGExecutionContext
from ... import processors
from ... import types as sqltypes
from ... import util


class PGNumeric(sqltypes.Numeric):
    def bind_processor(self, dialect):
        return processors.to_str

    def result_processor(self, dialect, coltype):
        if self.asdecimal:
            return None
        else:
            return processors.to_float


class PGExecutionContext_pypostgresql(PGExecutionContext):
    pass


class PGDialect_pypostgresql(PGDialect):
    driver = "pypostgresql"

    supports_statement_cache = True
    supports_unicode_statements = True
    supports_unicode_binds = True
    description_encoding = None
    default_paramstyle = "pyformat"

    # requires trunk version to support sane rowcounts
    # TODO: use dbapi version information to set this flag appropriately
    supports_sane_rowcount = True
    supports_sane_multi_rowcount = False

    execution_ctx_cls = PGExecutionContext_pypostgresql
    colspecs = util.update_copy(
        PGDialect.colspecs,
        {
            sqltypes.Numeric: PGNumeric,
            # prevents PGNumeric from being used
            sqltypes.Float: sqltypes.Float,
        },
    )

    @classmethod
    def dbapi(cls):
        from postgresql.driver import dbapi20

        # TODO update link
        util.warn_deprecated(
            "The py-postgresql DBAPI is deprecated and will be removed "
            "in a future version. This DBAPI is superseded by the external"
            "version available at https://github.com/PyGreSQL. Please "
            "use one of the supported DBAPIs to connect to PostgreSQL.",
            version="1.4",
        )

        return dbapi20

    _DBAPI_ERROR_NAMES = [
        "Error",
        "InterfaceError",
        "DatabaseError",
        "DataError",
        "OperationalError",
        "IntegrityError",
        "InternalError",
        "ProgrammingError",
        "NotSupportedError",
    ]

    @util.memoized_property
    def dbapi_exception_translation_map(self):
        if self.dbapi is None:
            return {}

        return dict(
            (getattr(self.dbapi, name).__name__, name)
            for name in self._DBAPI_ERROR_NAMES
        )

    def create_connect_args(self, url):
        opts = url.translate_connect_args(username="user")
        if "port" in opts:
            opts["port"] = int(opts["port"])
        else:
            opts["port"] = 5432
        opts.update(url.query)
        return ([], opts)

    def is_disconnect(self, e, connection, cursor):
        return "connection is closed" in str(e)


dialect = PGDialect_pypostgresql

Current_dir [ NOT WRITEABLE ] Document_root [ WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
23 Sep 2024 10.41 AM
root / root
0755
__init__.py
2.501 KB
5 Sep 2024 10.50 PM
root / root
0644
__init__.pyc
3.057 KB
23 Sep 2024 10.41 AM
root / root
0644
array.py
13.873 KB
5 Sep 2024 10.50 PM
root / root
0644
array.pyc
15.474 KB
23 Sep 2024 10.41 AM
root / root
0644
asyncpg.py
35.495 KB
5 Sep 2024 10.50 PM
root / root
0644
base.py
159.868 KB
5 Sep 2024 10.50 PM
root / root
0644
base.pyc
156.604 KB
23 Sep 2024 10.41 AM
root / root
0644
dml.py
9.345 KB
5 Sep 2024 10.50 PM
root / root
0644
dml.pyc
9.052 KB
23 Sep 2024 10.41 AM
root / root
0644
ext.py
8.458 KB
5 Sep 2024 10.50 PM
root / root
0644
ext.pyc
9.17 KB
23 Sep 2024 10.41 AM
root / root
0644
hstore.py
12.58 KB
5 Sep 2024 10.50 PM
root / root
0644
hstore.pyc
15.711 KB
23 Sep 2024 10.41 AM
root / root
0644
json.py
10.564 KB
5 Sep 2024 10.50 PM
root / root
0644
json.pyc
11.884 KB
23 Sep 2024 10.41 AM
root / root
0644
pg8000.py
16.653 KB
5 Sep 2024 10.50 PM
root / root
0644
pg8000.pyc
26.467 KB
23 Sep 2024 10.41 AM
root / root
0644
provision.py
4.465 KB
5 Sep 2024 10.50 PM
root / root
0644
provision.pyc
4.725 KB
23 Sep 2024 10.41 AM
root / root
0644
psycopg2.py
39.401 KB
5 Sep 2024 10.50 PM
root / root
0644
psycopg2.pyc
38.875 KB
23 Sep 2024 10.41 AM
root / root
0644
psycopg2cffi.py
1.668 KB
5 Sep 2024 10.50 PM
root / root
0644
psycopg2cffi.pyc
2.146 KB
23 Sep 2024 10.41 AM
root / root
0644
pygresql.py
8.393 KB
5 Sep 2024 10.50 PM
root / root
0644
pygresql.pyc
10.762 KB
23 Sep 2024 10.41 AM
root / root
0644
pypostgresql.py
3.615 KB
5 Sep 2024 10.50 PM
root / root
0644
pypostgresql.pyc
4.838 KB
23 Sep 2024 10.41 AM
root / root
0644
ranges.py
4.683 KB
5 Sep 2024 10.50 PM
root / root
0644
ranges.pyc
6.939 KB
23 Sep 2024 10.41 AM
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2026 CONTACT ME
Static GIF