summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/engine/interfaces.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2018-12-20 22:05:36 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2019-01-23 18:10:06 -0500
commit4c2c2c40fde17c85013e00a6f3303a99e2b32c12 (patch)
tree324a2c22eb61cb913e3e162e163f7baff14152cf /lib/sqlalchemy/engine/interfaces.py
parent5832f7172907a8151345d95061f93784ce4bb9b1 (diff)
downloadsqlalchemy-4c2c2c40fde17c85013e00a6f3303a99e2b32c12.tar.gz
Add deprecation warnings to all deprecated APIs
A large change throughout the library has ensured that all objects, parameters, and behaviors which have been noted as deprecated or legacy now emit ``DeprecationWarning`` warnings when invoked. As the Python 3 interpreter now defaults to displaying deprecation warnings, as well as that modern test suites based on tools like tox and pytest tend to display deprecation warnings, this change should make it easier to note what API features are obsolete. See the notes added to the changelog and migration notes for further details. Fixes: #4393 Change-Id: If0ea11a1fc24f9a8029352eeadfc49a7a54c0a1b
Diffstat (limited to 'lib/sqlalchemy/engine/interfaces.py')
-rw-r--r--lib/sqlalchemy/engine/interfaces.py30
1 files changed, 21 insertions, 9 deletions
diff --git a/lib/sqlalchemy/engine/interfaces.py b/lib/sqlalchemy/engine/interfaces.py
index d4cd55b2f..d579e6fdb 100644
--- a/lib/sqlalchemy/engine/interfaces.py
+++ b/lib/sqlalchemy/engine/interfaces.py
@@ -251,15 +251,15 @@ class Dialect(object):
raise NotImplementedError()
+ @util.deprecated(
+ "0.8",
+ "The :meth:`.Dialect.get_primary_keys` method is deprecated and "
+ "will be removed in a future release. Please refer to the "
+ ":meth:`.Dialect.get_pk_constraint` method. ",
+ )
def get_primary_keys(self, connection, table_name, schema=None, **kw):
"""Return information about primary keys in `table_name`.
- .. deprecated:: 0.8
-
- The :meth:`.Dialect.get_primary_keys` method is deprecated and
- will be removed in a future release. Please refer to the
- :meth:`.Dialect.get_pk_constraint` method.
-
"""
raise NotImplementedError()
@@ -1117,7 +1117,15 @@ class Connectable(object):
"""
- def contextual_connect(self):
+ @util.deprecated(
+ "1.3",
+ "The :meth:`.Engine.contextual_connect` and "
+ ":meth:`.Connection.contextual_connect` methods are deprecated. This "
+ "method is an artifact of the threadlocal engine strategy which is "
+ "also to be deprecated. For explicit connections from an "
+ ":class:`.Engine`, use the :meth:`.Engine.connect` method.",
+ )
+ def contextual_connect(self, *arg, **kw):
"""Return a :class:`.Connection` object which may be part of an ongoing
context.
@@ -1128,6 +1136,9 @@ class Connectable(object):
"""
+ return self._contextual_connect(*arg, **kw)
+
+ def _contextual_connect(self):
raise NotImplementedError()
@util.deprecated(
@@ -1136,7 +1147,7 @@ class Connectable(object):
"removed in a future release. Please use the ``.create()`` method "
"on specific schema objects to emit DDL sequences, including "
":meth:`.Table.create`, :meth:`.Index.create`, and "
- ":meth:`.MetaData.create_all`."
+ ":meth:`.MetaData.create_all`.",
)
def create(self, entity, **kwargs):
"""Emit CREATE statements for the given schema entity.
@@ -1150,7 +1161,8 @@ class Connectable(object):
"removed in a future release. Please use the ``.drop()`` method "
"on specific schema objects to emit DDL sequences, including "
":meth:`.Table.drop`, :meth:`.Index.drop`, and "
- ":meth:`.MetaData.drop_all`.")
+ ":meth:`.MetaData.drop_all`.",
+ )
def drop(self, entity, **kwargs):
"""Emit DROP statements for the given schema entity.
"""