--- /dev/null
+.. change::
+ :tags: bug, orm
+ :tickets: 6131
+
+ Fixed bug where combinations of the new "relationship with criteria"
+ feature could fail in conjunction with features that make use of the new
+ "lambda SQL" feature, including loader strategies such as selectinload and
+ lazyload, for more complicated scenarios such as polymorphic loading.
def _constructor(self):
return self.__element._constructor
- def _clone(self):
- clone = self.__element._clone()
+ def _clone(self, **kw):
+ clone = self.__element._clone(**kw)
if clone is self.__element:
# detect immutable, don't change anything
return self
self.__dict__.update(state)
def __repr__(self):
- return "BindParameter(%r, %r, type_=%r)" % (
+ return "%s(%r, %r, type_=%r)" % (
+ self.__class__.__name__,
self.key,
self.value,
self.type,
is_(expr1._generate_cache_key().bindparams[0], expr1._resolved.right)
is_(expr2._generate_cache_key().bindparams[0], expr2._resolved.right)
+ def test_cache_key_bindparam_matches_annotations(self):
+ t1 = table("t1", column("q"), column("p"))
+
+ def go():
+ expr = sql_util._deep_annotate((t1.c.q == 5), {"foo": "bar"})
+ stmt = coercions.expect(roles.WhereHavingRole, lambda: expr)
+ return stmt
+
+ self.assert_compile(go(), "t1.q = :q_1", checkparams={"q_1": 5})
+ self.assert_compile(go(), "t1.q = :q_1", checkparams={"q_1": 5})
+
def test_cache_key_instance_variable_issue_incorrect(self):
t1 = table("t1", column("q"), column("p"))