- session.merge() works with relations that specifically
don't include "merge" in their cascade options - the target
is ignored completely.
+
+ - fixed internal error which would occur if calling has()
+ or similar complex expression on a single-table inheritance
+ relation(). [ticket:1731]
- query.one() no longer applies LIMIT to the query, this to
ensure that it fully counts all object identities present
def clone(elem):
# check if element is present in the exclude list.
# take into account proxying relationships.
- if exclude and elem.proxy_set.intersection(exclude):
+ if exclude and \
+ hasattr(elem, 'proxy_set') and \
+ elem.proxy_set.intersection(exclude):
elem = elem._clone()
elif annotations != elem._annotations:
elem = elem._annotate(annotations.copy())
assert u2.compile().params == {'id_param':7}
assert u3.compile().params == {'id_param':10}
+ def test_in(self):
+ expr = t1.c.col1.in_(['foo', 'bar'])
+ expr2 = CloningVisitor().traverse(expr)
+ assert str(expr) == str(expr2)
+
def test_adapt_union(self):
u = union(t1.select().where(t1.c.col1==4), t1.select().where(t1.c.col1==5)).alias()
b5 = visitors.cloned_traverse(b3, {}, {'binary':visit_binary})
assert str(b5) == ":bar = table1.col2"
+ def test_annotate_expressions(self):
+ table1 = table('table1', column("col1"), column("col2"))
+
+ for expr, expected in [
+ (table1.c.col1, "table1.col1"),
+ (table1.c.col1 == 5, "table1.col1 = :col1_1"),
+ (table1.c.col1.in_([2,3,4]), "table1.col1 IN (:col1_1, :col1_2, :col1_3)")
+ ]:
+ eq_(str(expr), expected)
+ eq_(str(expr._annotate({})), expected)
+ eq_(str(sql_util._deep_annotate(expr, {})), expected)
+ eq_(str(sql_util._deep_annotate(expr, {}, exclude=[table1.c.col1])), expected)
+
+
def test_deannotate(self):
table1 = table('table1', column("col1"), column("col2"))