From 3ec009eefd126c8623ddd04e94f0297724b2b476 Mon Sep 17 00:00:00 2001 From: Federico Caselli Date: Wed, 30 Mar 2022 22:50:18 +0200 Subject: Update bindparam cache key The ``literal_execute`` parameter now takes part of the cache generation of a bindparam, since it changes the sql string generated by the compiler. Previously the correct bind values were used, but the ``literal_execute`` would be ignored on subsequent executions of the same query. Fixes: #7876 Change-Id: I6bf887f1a2fe31f9d0ab68f5b4ff315004d006b2 --- lib/sqlalchemy/sql/elements.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/sqlalchemy') diff --git a/lib/sqlalchemy/sql/elements.py b/lib/sqlalchemy/sql/elements.py index da1d50a53..c735085f8 100644 --- a/lib/sqlalchemy/sql/elements.py +++ b/lib/sqlalchemy/sql/elements.py @@ -1759,6 +1759,7 @@ class BindParameter(roles.InElementRole, ColumnElement[_T]): ("type", InternalTraversal.dp_type), ("callable", InternalTraversal.dp_plain_dict), ("value", InternalTraversal.dp_plain_obj), + ("literal_execute", InternalTraversal.dp_boolean), ] key: str @@ -1967,6 +1968,7 @@ class BindParameter(roles.InElementRole, ColumnElement[_T]): self.__class__, self.type._static_cache_key, self.key % anon_map if self._key_is_anon else self.key, + self.literal_execute, ) def _convert_to_unique(self): -- cgit v1.2.1