summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql/functions.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2020-10-29 12:38:42 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2020-10-30 20:22:13 -0400
commit0718add3714451c1ae8ca00215ffb6c0fabdf366 (patch)
treec472fbc4bb6052a87980ee93f5471fdff93e2338 /lib/sqlalchemy/sql/functions.py
parent10851b002844fa4f9de7af92dbb15cb1133497eb (diff)
downloadsqlalchemy-0718add3714451c1ae8ca00215ffb6c0fabdf366.tar.gz
Deprecate bind args, execute() methods that were missed
in particular text(bind), DDL.execute(). Change-Id: Ie85ae9f61219182f5649f68e5f52b4923843199c
Diffstat (limited to 'lib/sqlalchemy/sql/functions.py')
-rw-r--r--lib/sqlalchemy/sql/functions.py22
1 files changed, 19 insertions, 3 deletions
diff --git a/lib/sqlalchemy/sql/functions.py b/lib/sqlalchemy/sql/functions.py
index c7ddcc18a..6d331910d 100644
--- a/lib/sqlalchemy/sql/functions.py
+++ b/lib/sqlalchemy/sql/functions.py
@@ -607,6 +607,13 @@ class Function(FunctionElement):
("type", InternalTraversal.dp_type),
]
+ @util.deprecated_params(
+ bind=(
+ "2.0",
+ "The :paramref:`_sql.text.bind` argument is deprecated and "
+ "will be removed in SQLAlchemy 2.0.",
+ ),
+ )
def __init__(self, name, *clauses, **kw):
"""Construct a :class:`.Function`.
@@ -616,11 +623,20 @@ class Function(FunctionElement):
"""
self.packagenames = kw.pop("packagenames", None) or ()
self.name = name
- self._bind = kw.get("bind", None)
+
+ self._bind = self._get_bind(kw)
self.type = sqltypes.to_instance(kw.get("type_", None))
FunctionElement.__init__(self, *clauses, **kw)
+ def _get_bind(self, kw):
+ if "bind" in kw:
+ util.warn_deprecated_20(
+ "The Function.bind argument is deprecated and "
+ "will be removed in SQLAlchemy 2.0.",
+ )
+ return kw["bind"]
+
def _bind_param(self, operator, obj, type_=None):
return BindParameter(
self.name,
@@ -760,7 +776,7 @@ class GenericFunction(util.with_metaclass(_GenericMeta, Function)):
]
self._has_args = self._has_args or bool(parsed_args)
self.packagenames = ()
- self._bind = kwargs.get("bind", None)
+ self._bind = self._get_bind(kwargs)
self.clause_expr = ClauseList(
operator=operators.comma_op, group_contents=True, *parsed_args
).self_group()
@@ -794,7 +810,7 @@ class next_value(GenericFunction):
assert isinstance(
seq, schema.Sequence
), "next_value() accepts a Sequence object as input."
- self._bind = kw.get("bind", None)
+ self._bind = self._get_bind(kw)
self.sequence = seq
def compare(self, other, **kw):