diff options
author | Federico Caselli <cfederico87@gmail.com> | 2022-03-30 22:50:18 +0200 |
---|---|---|
committer | Federico Caselli <cfederico87@gmail.com> | 2022-03-30 23:36:18 +0200 |
commit | 3ec009eefd126c8623ddd04e94f0297724b2b476 (patch) | |
tree | 9706514a95b2013975a241e4dd2bb76f3c6dd061 /lib/sqlalchemy/sql/elements.py | |
parent | 12b67ae68309e715e3ab1b3d533f5a329dd5b6c6 (diff) | |
download | sqlalchemy-3ec009eefd126c8623ddd04e94f0297724b2b476.tar.gz |
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
Diffstat (limited to 'lib/sqlalchemy/sql/elements.py')
-rw-r--r-- | lib/sqlalchemy/sql/elements.py | 2 |
1 files changed, 2 insertions, 0 deletions
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): |