summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql
diff options
context:
space:
mode:
authorFederico Caselli <cfederico87@gmail.com>2022-03-30 22:50:18 +0200
committerFederico Caselli <cfederico87@gmail.com>2022-03-30 23:17:31 +0200
commitb1aaf0a29fdb950ac69964fb9f96dbc03cddd139 (patch)
treeb79ca47e650bfce99b1768272e64646a0d604637 /lib/sqlalchemy/sql
parentaade1973639517dff06d9f5147c2ec67fc5e3a8d (diff)
downloadsqlalchemy-b1aaf0a29fdb950ac69964fb9f96dbc03cddd139.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 (cherry picked from commit 429512d55e814b03854bc12ec541dbeee9e3b94e)
Diffstat (limited to 'lib/sqlalchemy/sql')
-rw-r--r--lib/sqlalchemy/sql/elements.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/sqlalchemy/sql/elements.py b/lib/sqlalchemy/sql/elements.py
index 2c424a5f5..81645ad0a 100644
--- a/lib/sqlalchemy/sql/elements.py
+++ b/lib/sqlalchemy/sql/elements.py
@@ -1230,6 +1230,7 @@ class BindParameter(roles.InElementRole, ColumnElement):
("type", InternalTraversal.dp_type),
("callable", InternalTraversal.dp_plain_dict),
("value", InternalTraversal.dp_plain_obj),
+ ("literal_execute", InternalTraversal.dp_boolean),
]
_is_crud = False
@@ -1663,6 +1664,7 @@ class BindParameter(roles.InElementRole, ColumnElement):
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):