of "SomeClass.somerelationship" when used in a
core SQL context; previously, it would "resolve"
to the parent selectable, which wasn't generally
- useful. Related to [ticket:2245].
+ useful. Also works with query.filter().
+ Related to [ticket:2245].
- [feature] The registry of classes
in declarative_base() is now a
"""
for criterion in list(criterion):
- if isinstance(criterion, basestring):
- criterion = sql.text(criterion)
-
- if criterion is not None and \
- not isinstance(criterion, sql.ClauseElement):
- raise sa_exc.ArgumentError(
- "filter() argument must be of type "
- "sqlalchemy.sql.ClauseElement or string")
+ criterion = expression._literal_as_text(criterion)
criterion = self._adapt_clause(criterion, True, True)
#assert [User(id=7), User(id=9), User(id=10)] == sess.query(User).filter(User.addresses!=address).all()
+ def test_clause_element_ok(self):
+ User = self.classes.User
+ s = Session()
+ self.assert_compile(
+ s.query(User).filter(User.addresses),
+ "SELECT users.id AS users_id, users.name AS users_name "
+ "FROM users, addresses WHERE users.id = addresses.user_id"
+ )
+
def test_unique_binds_join_cond(self):
"""test that binds used when the lazyclause is used in criterion are unique"""