title: SQLAlchemy: filter by relationship
body: <p>I have 2 tables, <code>User</code> and <code>Object</code>, which have a one-to-many relationship (a <code>User</code> can have many <code>objects</code> ).</p>
  
  <p>How can I filter for users that have at least one object, in a pep8 compliant way?</p>
  
  <p>This code works, but is not pep8-compliant:</p>
  
  <pre><code>query = session.query(User.id)
  query = query.filter(User.objects != None)
  </code></pre>
  
  <p>The documentation mentions using <code>isnot</code>: <a href="http://docs.sqlalchemy.org/en/rel_1_0/orm/tutorial.html#common-filter-operators" rel="noreferrer">http://docs.sqlalchemy.org/en/rel_1_0/orm/tutorial.html#common-filter-operators</a></p>
  
  <p>But the following code gives rise to a not implemented error.</p>
  
  <pre><code>query = session.query(User.id)
  query = query.filter(User.objects.isnot(None))
  </code></pre>