$50 GRAYBYTE WORDPRESS FILE MANAGER $45

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/mysql/

HOME
Current File : /usr/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql//pymysql.py
# dialects/mysql/pymysql.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

r"""

.. dialect:: mysql+pymysql
    :name: PyMySQL
    :dbapi: pymysql
    :connectstring: mysql+pymysql://<username>:<password>@<host>/<dbname>[?<options>]
    :url: https://pymysql.readthedocs.io/

Unicode
-------

Please see :ref:`mysql_unicode` for current recommendations on unicode
handling.

.. _pymysql_ssl:

SSL Connections
------------------

The PyMySQL DBAPI accepts the same SSL arguments as that of MySQLdb,
described at :ref:`mysqldb_ssl`.   See that section for additional examples.

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 indicate ``ssl_check_hostname=false`` in PyMySQL::

    connection_uri = (
        "mysql+pymysql://scott:tiger@192.168.0.134/test"
        "?ssl_ca=/home/gord/client-ssl/ca.pem"
        "&ssl_cert=/home/gord/client-ssl/client-cert.pem"
        "&ssl_key=/home/gord/client-ssl/client-key.pem"
        "&ssl_check_hostname=false"
    )


MySQL-Python Compatibility
--------------------------

The pymysql DBAPI is a pure Python port of the MySQL-python (MySQLdb) driver,
and targets 100% compatibility.   Most behavioral notes for MySQL-python apply
to the pymysql driver as well.

"""  # noqa

from .mysqldb import MySQLDialect_mysqldb
from ...util import langhelpers
from ...util import py3k


class MySQLDialect_pymysql(MySQLDialect_mysqldb):
    driver = "pymysql"
    supports_statement_cache = True

    description_encoding = None

    # generally, these two values should be both True
    # or both False.   PyMySQL unicode tests pass all the way back
    # to 0.4 either way.  See [ticket:3337]
    supports_unicode_statements = True
    supports_unicode_binds = True

    @langhelpers.memoized_property
    def supports_server_side_cursors(self):
        try:
            cursors = __import__("pymysql.cursors").cursors
            self._sscursor = cursors.SSCursor
            return True
        except (ImportError, AttributeError):
            return False

    @classmethod
    def dbapi(cls):
        return __import__("pymysql")

    @langhelpers.memoized_property
    def _send_false_to_ping(self):
        """determine if pymysql has deprecated, changed the default of,
        or removed the 'reconnect' argument of connection.ping().

        See #10492 and
        https://github.com/PyMySQL/mysqlclient/discussions/651#discussioncomment-7308971
        for background.

        """  # noqa: E501

        try:
            Connection = __import__(
                "pymysql.connections"
            ).connections.Connection
        except (ImportError, AttributeError):
            return True
        else:
            insp = langhelpers.get_callable_argspec(Connection.ping)
            try:
                reconnect_arg = insp.args[1]
            except IndexError:
                return False
            else:
                return reconnect_arg == "reconnect" and (
                    not insp.defaults or insp.defaults[0] is not False
                )

    def _ping_impl(self, dbapi_connection):
        if self._send_false_to_ping:
            dbapi_connection.ping(False)
        else:
            dbapi_connection.ping()

        return True

    def create_connect_args(self, url, _translate_args=None):
        if _translate_args is None:
            _translate_args = dict(username="user")
        return super(MySQLDialect_pymysql, self).create_connect_args(
            url, _translate_args=_translate_args
        )

    def is_disconnect(self, e, connection, cursor):
        if super(MySQLDialect_pymysql, self).is_disconnect(
            e, connection, cursor
        ):
            return True
        elif isinstance(e, self.dbapi.Error):
            str_e = str(e).lower()
            return (
                "already closed" in str_e or "connection was killed" in str_e
            )
        else:
            return False

    if py3k:

        def _extract_error_code(self, exception):
            if isinstance(exception.args[0], Exception):
                exception = exception.args[0]
            return exception.args[0]


dialect = MySQLDialect_pymysql

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.147 KB
5 Sep 2024 10.50 PM
root / root
0644
__init__.pyc
2.592 KB
23 Sep 2024 10.41 AM
root / root
0644
aiomysql.py
9.313 KB
5 Sep 2024 10.50 PM
root / root
0644
asyncmy.py
9.443 KB
5 Sep 2024 10.50 PM
root / root
0644
base.py
112.675 KB
5 Sep 2024 10.50 PM
root / root
0644
base.pyc
108.136 KB
23 Sep 2024 10.41 AM
root / root
0644
cymysql.py
2.227 KB
5 Sep 2024 10.50 PM
root / root
0644
cymysql.pyc
3.12 KB
23 Sep 2024 10.41 AM
root / root
0644
dml.py
6.316 KB
5 Sep 2024 10.50 PM
root / root
0644
dml.pyc
6.414 KB
23 Sep 2024 10.41 AM
root / root
0644
enumerated.py
9.153 KB
5 Sep 2024 10.50 PM
root / root
0644
enumerated.pyc
9.959 KB
23 Sep 2024 10.41 AM
root / root
0644
expression.py
3.896 KB
5 Sep 2024 10.50 PM
root / root
0644
expression.pyc
4.366 KB
23 Sep 2024 10.41 AM
root / root
0644
json.py
2.268 KB
5 Sep 2024 10.50 PM
root / root
0644
json.pyc
3.476 KB
23 Sep 2024 10.41 AM
root / root
0644
mariadb.py
0.812 KB
5 Sep 2024 10.50 PM
root / root
0644
mariadb.pyc
1.024 KB
23 Sep 2024 10.41 AM
root / root
0644
mariadbconnector.py
7.395 KB
5 Sep 2024 10.50 PM
root / root
0644
mariadbconnector.pyc
8.521 KB
23 Sep 2024 10.41 AM
root / root
0644
mysqlconnector.py
7.519 KB
5 Sep 2024 10.50 PM
root / root
0644
mysqlconnector.pyc
9.853 KB
23 Sep 2024 10.41 AM
root / root
0644
mysqldb.py
9.797 KB
5 Sep 2024 10.50 PM
root / root
0644
mysqldb.pyc
10.525 KB
23 Sep 2024 10.41 AM
root / root
0644
oursql.py
8.332 KB
5 Sep 2024 10.50 PM
root / root
0644
oursql.pyc
10.027 KB
23 Sep 2024 10.41 AM
root / root
0644
provision.py
2.829 KB
5 Sep 2024 10.50 PM
root / root
0644
provision.pyc
2.584 KB
23 Sep 2024 10.41 AM
root / root
0644
pymysql.py
4.32 KB
5 Sep 2024 10.50 PM
root / root
0644
pymysql.pyc
4.745 KB
23 Sep 2024 10.41 AM
root / root
0644
pyodbc.py
4.198 KB
5 Sep 2024 10.50 PM
root / root
0644
pyodbc.pyc
4.935 KB
23 Sep 2024 10.41 AM
root / root
0644
reflection.py
18.431 KB
5 Sep 2024 10.50 PM
root / root
0644
reflection.pyc
15.017 KB
23 Sep 2024 10.41 AM
root / root
0644
reserved_words.py
8.899 KB
5 Sep 2024 10.50 PM
root / root
0644
reserved_words.pyc
6.491 KB
23 Sep 2024 10.41 AM
root / root
0644
types.py
24.096 KB
5 Sep 2024 10.50 PM
root / root
0644
types.pyc
31.641 KB
23 Sep 2024 10.41 AM
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2026 CONTACT ME
Static GIF