summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql
diff options
context:
space:
mode:
authormike bayer <mike_mp@zzzcomputing.com>2020-04-10 17:52:47 +0000
committerGerrit Code Review <gerrit@bbpush.zzzcomputing.com>2020-04-10 17:52:47 +0000
commit1ff644d2f16a7517df7f175e1291ddaa501646dd (patch)
treea8f6e624e1500f3b77e43a22eaeb0e7b8ff20100 /lib/sqlalchemy/sql
parentfe591913030a244a9ccfdd47b371609f1f1b44af (diff)
parenta9b068ae564e5e775e312373088545b75aeaa1b0 (diff)
downloadsqlalchemy-1ff644d2f16a7517df7f175e1291ddaa501646dd.tar.gz
Merge "Remove code deprecated before version 1.1"
Diffstat (limited to 'lib/sqlalchemy/sql')
-rw-r--r--lib/sqlalchemy/sql/coercions.py9
-rw-r--r--lib/sqlalchemy/sql/compiler.py20
-rw-r--r--lib/sqlalchemy/sql/elements.py85
-rw-r--r--lib/sqlalchemy/sql/schema.py10
-rw-r--r--lib/sqlalchemy/sql/selectable.py30
-rw-r--r--lib/sqlalchemy/sql/sqltypes.py13
-rw-r--r--lib/sqlalchemy/sql/type_api.py19
7 files changed, 18 insertions, 168 deletions
diff --git a/lib/sqlalchemy/sql/coercions.py b/lib/sqlalchemy/sql/coercions.py
index e605b486b..fc168aa1d 100644
--- a/lib/sqlalchemy/sql/coercions.py
+++ b/lib/sqlalchemy/sql/coercions.py
@@ -191,7 +191,8 @@ class _ColumnCoercions(object):
"column-expression context is deprecated in version 1.4; "
"please use the .scalar_subquery() method to produce a scalar "
"subquery. This automatic coercion will be removed in a "
- "future release."
+ "future release.",
+ version="1.4",
)
def _implicit_coercions(
@@ -614,7 +615,8 @@ class FromClauseImpl(
"Implicit coercion of SELECT and textual SELECT "
"constructs into FROM clauses is deprecated; please call "
".subquery() on any Core select or ORM Query object in "
- "order to produce a subquery object."
+ "order to produce a subquery object.",
+ version="1.4",
)
return resolved._implicit_subquery
elif resolved._is_text_clause:
@@ -637,7 +639,8 @@ class StrictFromClauseImpl(FromClauseImpl, roles.StrictFromClauseRole):
"Implicit coercion of SELECT and textual SELECT constructs "
"into FROM clauses is deprecated; please call .subquery() "
"on any Core select or ORM Query object in order to produce a "
- "subquery object."
+ "subquery object.",
+ version="1.4",
)
return resolved._implicit_subquery
else:
diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py
index b93ed8890..23b15b158 100644
--- a/lib/sqlalchemy/sql/compiler.py
+++ b/lib/sqlalchemy/sql/compiler.py
@@ -434,18 +434,6 @@ class Compiled(object):
self.string, schema_translate_map
)
- @util.deprecated(
- "0.7",
- "The :meth:`.Compiled.compile` method is deprecated and will be "
- "removed in a future release. The :class:`.Compiled` object "
- "now runs its compilation within the constructor, and this method "
- "does nothing.",
- )
- def compile(self):
- """Produce the internal string representation of this element.
- """
- pass
-
def _execute_on_connection(self, connection, multiparams, params):
if self.can_execute:
return connection._execute_compiled(self, multiparams, params)
@@ -4244,7 +4232,9 @@ class IdentifierPreparer(object):
"deprecated and will be removed in a future release. This "
"flag has no effect on the behavior of the "
"IdentifierPreparer.quote method; please refer to "
- "quoted_name()."
+ "quoted_name().",
+ # deprecated 0.9. warning from 1.3
+ version="0.9",
)
return self.quote(schema)
@@ -4280,7 +4270,9 @@ class IdentifierPreparer(object):
"deprecated and will be removed in a future release. This "
"flag has no effect on the behavior of the "
"IdentifierPreparer.quote method; please refer to "
- "quoted_name()."
+ "quoted_name().",
+ # deprecated 0.9. warning from 1.3
+ version="0.9",
)
force = getattr(ident, "quote", None)
diff --git a/lib/sqlalchemy/sql/elements.py b/lib/sqlalchemy/sql/elements.py
index 57d41b06f..9689c7a8a 100644
--- a/lib/sqlalchemy/sql/elements.py
+++ b/lib/sqlalchemy/sql/elements.py
@@ -505,30 +505,6 @@ class ClauseElement(
"ascii", "backslashreplace"
) # noqa
- @util.deprecated(
- "0.9",
- "The :meth:`.ClauseElement.__and__` method is deprecated and will "
- "be removed in a future release. Conjunctions should only be "
- "used from a :class:`.ColumnElement` subclass, e.g. "
- ":meth:`.ColumnElement.__and__`.",
- )
- def __and__(self, other):
- """'and' at the ClauseElement level.
- """
- return and_(self, other)
-
- @util.deprecated(
- "0.9",
- "The :meth:`.ClauseElement.__or__` method is deprecated and will "
- "be removed in a future release. Conjunctions should only be "
- "used from a :class:`.ColumnElement` subclass, e.g. "
- ":meth:`.ColumnElement.__or__`.",
- )
- def __or__(self, other):
- """'or' at the ClauseElement level.
- """
- return or_(self, other)
-
def __invert__(self):
# undocumented element currently used by the ORM for
# relationship.contains()
@@ -1523,22 +1499,8 @@ class TextClause(
self.text = self._bind_params_regex.sub(repl, text)
@classmethod
- @util.deprecated_params(
- bindparams=(
- "0.9",
- "The :paramref:`.text.bindparams` parameter "
- "is deprecated and will be removed in a future release. Please "
- "refer to the :meth:`.TextClause.bindparams` method.",
- ),
- typemap=(
- "0.9",
- "The :paramref:`.text.typemap` parameter is "
- "deprecated and will be removed in a future release. Please "
- "refer to the :meth:`.TextClause.columns` method.",
- ),
- )
@_document_text_coercion("text", ":func:`.text`", ":paramref:`.text.text`")
- def _create_text(self, text, bind=None, bindparams=None, typemap=None):
+ def _create_text(cls, text, bind=None):
r"""Construct a new :class:`.TextClause` clause, representing
a textual SQL string directly.
@@ -1617,25 +1579,6 @@ class TextClause(
:param bind:
an optional connection or engine to be used for this text query.
- :param bindparams:
- A list of :func:`.bindparam` instances used to
- provide information about parameters embedded in the statement.
-
- E.g.::
-
- stmt = text("SELECT * FROM table WHERE id=:id",
- bindparams=[bindparam('id', value=5, type_=Integer)])
-
- :param typemap:
- A dictionary mapping the names of columns represented in the columns
- clause of a ``SELECT`` statement to type objects.
-
- E.g.::
-
- stmt = text("SELECT * FROM table",
- typemap={'id': Integer, 'name': String},
- )
-
.. seealso::
:ref:`sqlexpression_text` - in the Core tutorial
@@ -1643,13 +1586,7 @@ class TextClause(
:ref:`orm_tutorial_literal_sql` - in the ORM tutorial
"""
- stmt = TextClause(text, bind=bind)
- if bindparams:
- stmt = stmt.bindparams(*bindparams)
- if typemap:
- stmt = stmt.columns(**typemap)
-
- return stmt
+ return TextClause(text, bind=bind)
@_generative
def bindparams(self, *binds, **names_to_values):
@@ -2233,7 +2170,8 @@ class BooleanClauseList(ClauseList, ColumnElement):
"continue_on": "True"
if continue_on is True_._singleton
else "False",
- }
+ },
+ version="1.4",
)
return cls._construct_raw(operator)
@@ -3751,21 +3689,6 @@ class Over(ColumnElement):
return lower, upper
- @property
- @util.deprecated(
- "1.1",
- "the :attr:`.Over.func` member of the :class:`.Over` "
- "class is deprecated and will be removed in a future release. "
- "Please refer to the :attr:`.Over.element` attribute.",
- )
- def func(self):
- """the element referred to by this :class:`.Over`
- clause.
-
-
- """
- return self.element
-
@util.memoized_property
def type(self):
return self.element.type
diff --git a/lib/sqlalchemy/sql/schema.py b/lib/sqlalchemy/sql/schema.py
index eb6c12f80..d1abaed3b 100644
--- a/lib/sqlalchemy/sql/schema.py
+++ b/lib/sqlalchemy/sql/schema.py
@@ -408,8 +408,6 @@ class Table(DialectKWArgs, SchemaItem, TableClause):
name, specify the flag ``quote_schema=True`` to the constructor, or use
the :class:`.quoted_name` construct to specify the name.
- :param useexisting: the same as :paramref:`.Table.extend_existing`.
-
:param comment: Optional string that will render an SQL comment on table
creation.
@@ -432,14 +430,6 @@ class Table(DialectKWArgs, SchemaItem, TableClause):
def _gen_cache_key(self, anon_map, bindparams):
return (self,) + self._annotations_cache_key
- @util.deprecated_params(
- useexisting=(
- "0.7",
- "The :paramref:`.Table.useexisting` parameter is deprecated and "
- "will be removed in a future release. Please use "
- ":paramref:`.Table.extend_existing`.",
- )
- )
def __new__(cls, *args, **kw):
if not args:
# python3k pickle seems to call this
diff --git a/lib/sqlalchemy/sql/selectable.py b/lib/sqlalchemy/sql/selectable.py
index a0df45b52..595b1bdfa 100644
--- a/lib/sqlalchemy/sql/selectable.py
+++ b/lib/sqlalchemy/sql/selectable.py
@@ -365,36 +365,6 @@ class FromClause(roles.AnonymizedFromClauseRole, Selectable):
_use_schema_map = False
- @util.deprecated(
- "1.1",
- message="The :meth:`.FromClause.count` method is deprecated, "
- "and will be removed in a future release. Please use the "
- ":class:`.functions.count` function available from the "
- ":attr:`.func` namespace.",
- )
- @util.preload_module("sqlalchemy.sql.functions")
- def count(self, whereclause=None, **params):
- """return a SELECT COUNT generated against this
- :class:`.FromClause`.
-
- .. seealso::
-
- :class:`.functions.count`
-
- """
- functions = util.preloaded.sql_functions
- if self.primary_key:
- col = list(self.primary_key)[0]
- else:
- col = list(self.columns)[0]
- return Select._create_select_from_fromclause(
- self,
- [functions.func.count(col).label("tbl_row_count")],
- whereclause,
- from_obj=[self],
- **params
- )
-
def select(self, whereclause=None, **params):
"""return a SELECT of this :class:`.FromClause`.
diff --git a/lib/sqlalchemy/sql/sqltypes.py b/lib/sqlalchemy/sql/sqltypes.py
index af4e4db91..245b809ae 100644
--- a/lib/sqlalchemy/sql/sqltypes.py
+++ b/lib/sqlalchemy/sql/sqltypes.py
@@ -329,7 +329,8 @@ class String(Concatenable, TypeEngine):
"unicode_error flag on String are deprecated. All modern "
"DBAPIs now support Python Unicode natively under Python 2, and "
"under Python 3 all strings are inherently Unicode. These flags "
- "will be removed in a future release."
+ "will be removed in a future release.",
+ version="1.3",
)
@@ -967,16 +968,6 @@ class LargeBinary(_Binary):
_Binary.__init__(self, length=length)
-@util.deprecated_cls(
- "0.6",
- "The :class:`.Binary` class is deprecated and will be removed "
- "in a future relase. Please use :class:`.LargeBinary`.",
-)
-class Binary(LargeBinary):
- def __init__(self, *arg, **kw):
- LargeBinary.__init__(self, *arg, **kw)
-
-
class SchemaType(SchemaEventTarget):
"""Mark a type as possibly requiring schema-level DDL for usage.
diff --git a/lib/sqlalchemy/sql/type_api.py b/lib/sqlalchemy/sql/type_api.py
index e3929fac7..e9632c502 100644
--- a/lib/sqlalchemy/sql/type_api.py
+++ b/lib/sqlalchemy/sql/type_api.py
@@ -692,25 +692,6 @@ class UserDefinedType(util.with_metaclass(VisitableCheckKWArg, TypeEngine)):
ensure_kwarg = "get_col_spec"
- class Comparator(TypeEngine.Comparator):
- __slots__ = ()
-
- def _adapt_expression(self, op, other_comparator):
- if hasattr(self.type, "adapt_operator"):
- util.warn_deprecated(
- "UserDefinedType.adapt_operator is deprecated. Create "
- "a UserDefinedType.Comparator subclass instead which "
- "generates the desired expression constructs, given a "
- "particular operator."
- )
- return self.type.adapt_operator(op), self.type
- else:
- return super(
- UserDefinedType.Comparator, self
- )._adapt_expression(op, other_comparator)
-
- comparator_factory = Comparator
-
def coerce_compared_value(self, op, value):
"""Suggest a type for a 'coerced' Python value in an expression.