From a9b068ae564e5e775e312373088545b75aeaa1b0 Mon Sep 17 00:00:00 2001 From: Federico Caselli Date: Wed, 8 Apr 2020 20:26:21 +0200 Subject: Remove code deprecated before version 1.1 - Remove deprecated method ``get_primary_keys` in the :class:`.Dialect` and :class:`.Inspector` classes. - Remove deprecated event ``dbapi_error`` and the method ``ConnectionEvents.dbapi_error`. - Remove support for deprecated engine URLs of the form ``postgres://``. - Remove deprecated dialect ``mysql+gaerdbms``. - Remove deprecated parameter ``quoting`` from :class:`.mysql.ENUM` and :class:`.mysql.SET` in the ``mysql`` dialect. - Remove deprecated function ``comparable_property``. and function ``comparable_using`` in the declarative extension. - Remove deprecated function ``compile_mappers``. - Remove deprecated method ``collection.linker``. - Remove deprecated method ``Session.prune`` and parameter ``Session.weak_identity_map``. This change also removes the class ``StrongInstanceDict``. - Remove deprecated parameter ``mapper.order_by``. - Remove deprecated parameter ``Session._enable_transaction_accounting`. - Remove deprecated parameter ``Session.is_modified.passive``. - Remove deprecated class ``Binary``. Please use :class:`.LargeBinary`. - Remove deprecated methods ``Compiled.compile``, ``ClauseElement.__and__`` and ``ClauseElement.__or__`` and attribute ``Over.func``. - Remove deprecated ``FromClause.count`` method. - Remove deprecated parameter ``Table.useexisting``. - Remove deprecated parameters ``text.bindparams`` and ``text.typemap``. - Remove boolean support for the ``passive`` parameter in ``get_history``. - Remove deprecated ``adapt_operator`` in ``UserDefinedType.Comparator``. Fixes: #4643 Change-Id: Idcd390c77bf7b0e9957907716993bdaa3f1a1763 --- lib/sqlalchemy/dialects/mysql/gaerdbms.py | 102 ------------------------------ 1 file changed, 102 deletions(-) delete mode 100644 lib/sqlalchemy/dialects/mysql/gaerdbms.py (limited to 'lib/sqlalchemy/dialects/mysql/gaerdbms.py') diff --git a/lib/sqlalchemy/dialects/mysql/gaerdbms.py b/lib/sqlalchemy/dialects/mysql/gaerdbms.py deleted file mode 100644 index 0ba819d2d..000000000 --- a/lib/sqlalchemy/dialects/mysql/gaerdbms.py +++ /dev/null @@ -1,102 +0,0 @@ -# mysql/gaerdbms.py -# Copyright (C) 2005-2020 the SQLAlchemy authors and contributors -# -# -# This module is part of SQLAlchemy and is released under -# the MIT License: http://www.opensource.org/licenses/mit-license.php -r""" -.. dialect:: mysql+gaerdbms - :name: Google Cloud SQL - :dbapi: rdbms - :connectstring: mysql+gaerdbms:///?instance= - :url: https://developers.google.com/appengine/docs/python/cloud-sql/developers-guide - - This dialect is based primarily on the :mod:`.mysql.mysqldb` dialect with - minimal changes. - - .. deprecated:: 1.0 This dialect is **no longer necessary** for - Google Cloud SQL; the MySQLdb dialect can be used directly. - Cloud SQL now recommends creating connections via the - mysql dialect using the URL format - - ``mysql+mysqldb://root@/?unix_socket=/cloudsql/:`` - - -Pooling -------- - -Google App Engine connections appear to be randomly recycled, -so the dialect does not pool connections. The :class:`.NullPool` -implementation is installed within the :class:`.Engine` by -default. - -""" # noqa - -import os -import re - -from sqlalchemy.util import warn_deprecated -from .mysqldb import MySQLDialect_mysqldb -from ...pool import NullPool - - -def _is_dev_environment(): - return os.environ.get("SERVER_SOFTWARE", "").startswith("Development/") - - -class MySQLDialect_gaerdbms(MySQLDialect_mysqldb): - @classmethod - def dbapi(cls): - - warn_deprecated( - "Google Cloud SQL now recommends creating connections via the " - "MySQLdb dialect directly, using the URL format " - "mysql+mysqldb://root@/?unix_socket=/cloudsql/" - ":" - ) - - # from django: - # http://code.google.com/p/googleappengine/source/ - # browse/trunk/python/google/storage/speckle/ - # python/django/backend/base.py#118 - # see also [ticket:2649] - # see also http://stackoverflow.com/q/14224679/34549 - from google.appengine.api import apiproxy_stub_map - - if _is_dev_environment(): - from google.appengine.api import rdbms_mysqldb - - return rdbms_mysqldb - elif apiproxy_stub_map.apiproxy.GetStub("rdbms"): - from google.storage.speckle.python.api import rdbms_apiproxy - - return rdbms_apiproxy - else: - from google.storage.speckle.python.api import rdbms_googleapi - - return rdbms_googleapi - - @classmethod - def get_pool_class(cls, url): - # Cloud SQL connections die at any moment - return NullPool - - def create_connect_args(self, url): - opts = url.translate_connect_args() - if not _is_dev_environment(): - # 'dsn' and 'instance' are because we are skipping - # the traditional google.api.rdbms wrapper - opts["dsn"] = "" - opts["instance"] = url.query["instance"] - return [], opts - - def _extract_error_code(self, exception): - match = re.compile(r"^(\d+)L?:|^\((\d+)L?,").match(str(exception)) - # The rdbms api will wrap then re-raise some types of errors - # making this regex return no matches. - code = match.group(1) or match.group(2) if match else None - if code: - return int(code) - - -dialect = MySQLDialect_gaerdbms -- cgit v1.2.1