title: Is it possible to use a function in an SQLAlchemy filter?
body: <p>I have a function that checks an object for some properties and returns boolean values depending on the result. It's too complex to write it in filter, but it works and returns the right value.</p>
  
  <p>Now I want to use sqlalchemy to return all objects that this function returns True for. I tried:</p>
  
  <pre><code>DBSession.query(MyObject).filter(self.check_attributes(MyObject) == True).all()
  </code></pre>
  
  <p>and</p>
  
  <pre><code>DBSession.query(MyObject).filter(self.check_attributes(MyObject)).all()
  </code></pre>
  
  <p>Both failed to select the right objects. What am I doing wrong?</p>