summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy
diff options
context:
space:
mode:
authormike bayer <mike_mp@zzzcomputing.com>2020-09-12 13:10:19 +0000
committerGerrit Code Review <gerrit@bbpush.zzzcomputing.com>2020-09-12 13:10:19 +0000
commit34870a0f6e7052c784eba8ad639cb4d981a2cd41 (patch)
tree094a20a695ce0369c2653f819fb30e766b0286c7 /lib/sqlalchemy
parente2eba7d74403316b4df4d2cc12f1aea36d209c2f (diff)
parentfe6c3605df25d083c20f39fbd176a0c0a6736056 (diff)
downloadsqlalchemy-34870a0f6e7052c784eba8ad639cb4d981a2cd41.tar.gz
Merge "Emit deprecation warning for **kw passed to session.execute()"
Diffstat (limited to 'lib/sqlalchemy')
-rw-r--r--lib/sqlalchemy/orm/session.py27
1 files changed, 19 insertions, 8 deletions
diff --git a/lib/sqlalchemy/orm/session.py b/lib/sqlalchemy/orm/session.py
index 0c012d7f3..535f030cf 100644
--- a/lib/sqlalchemy/orm/session.py
+++ b/lib/sqlalchemy/orm/session.py
@@ -1561,10 +1561,18 @@ class Session(_SessionClassMethods):
"""
statement = coercions.expect(roles.CoerceTextStatementRole, statement)
- if not bind_arguments:
- bind_arguments = kw
- elif kw:
- bind_arguments.update(kw)
+ if kw:
+ util.warn_deprecated_20(
+ "Passing bind arguments to Session.execute() as keyword "
+ "arguments is deprecated and will be removed SQLAlchemy 2.0. "
+ "Please use the bind_arguments parameter."
+ )
+ if not bind_arguments:
+ bind_arguments = kw
+ else:
+ bind_arguments.update(kw)
+ elif not bind_arguments:
+ bind_arguments = {}
if future and (
statement._propagate_attrs.get("compile_state_plugin", None)
@@ -1645,15 +1653,18 @@ class Session(_SessionClassMethods):
self,
statement,
params=None,
- execution_options=None,
- mapper=None,
- bind=None,
+ execution_options=util.EMPTY_DICT,
+ bind_arguments=None,
**kw
):
"""Like :meth:`~.Session.execute` but return a scalar result."""
return self.execute(
- statement, params=params, mapper=mapper, bind=bind, **kw
+ statement,
+ params=params,
+ execution_options=execution_options,
+ bind_arguments=bind_arguments,
+ **kw
).scalar()
def close(self):