title: sqlalchemy, select using reverse-inclusive (not in) list of child column values
body: <p>I have a typical Post / Tags (many tags associated with one post) relationship in flask-sqlalchemy, and I want to select posts which aren't tagged with any tag in a list I provide. First, the models I set up:</p>
  
  <pre><code>class Post(db.Model):
      id = db.Column(db.Integer, primary_key=True)
      tags = db.relationship('Tag', lazy='dynamic')
  
  class Tag(db.Model):
      id = db.Column(db.Integer, primary_key=True)
      name = db.Column(db.Text(50))
      post_id = db.Column(db.Integer, db.ForeignKey('post.id'))
  </code></pre>
  
  <p>Something like </p>
  
  <p><code>db.session.query(Post).filter(Post.tags.name.notin_(['dont','want','these']))</code> </p>
  
  <p>fails with </p>
  
  <p><code>AttributeError: Neither 'InstrumentedAttribute' object nor 'Comparator' object associated with Post.tags has an attribute 'name'</code></p>
  
  <p>which I assume is because tags is a relationship and not a column. I had this working on another project when I was writing the actual SQL manually. This was the SQL that worked: </p>
  
  <p><code>SELECT * FROM $posts WHERE id NOT IN (SELECT post_id FROM $tags WHERE name IN ('dont','want','these'))</code></p>
  
  <p>How would I achieve this using the sqlalchemy API?</p>