title: flask-sqlalchemy, select using reverse-inclusive (not in) a set
body: <p>I have 3 models Post, Comments, User:</p>
  
  <pre><code>class User(UserMixin, db.Model):
      __tablename__ = 'users'
      id = db.Column(db.Integer, primary_key=True)
      username = db.Column(db.String(64), unique=True, index=True)
      posts = db.relationship('Post', backref='author', lazy='dynamic')
      comments = db.relationship('Comment', backref='author', lazy='dynamic')
  
  class Post(db.Model):
      __tablename__ = 'posts'
      id = db.Column(db.Integer, primary_key=True)
      body = db.Column(db.Text)
      author_id = db.Column(db.Integer, db.ForeignKey('users.id'))
      comments = db.relationship('Comment', backref='post', lazy='dynamic')
  
  class Comment(db.Model):
      __tablename__ = 'comments'
      id = db.Column(db.Integer, primary_key=True)
      body = db.Column(db.Text)
      author_id = db.Column(db.Integer, db.ForeignKey('users.id'))
      post_id = db.Column(db.Integer, db.ForeignKey('posts.id'))
  </code></pre>
  
  <p>my question:
  how can I filter those posts those have NOT been commented by a given user(given user.id)</p>
  
  <p>I have a piece of code for filtering posts those are commented by a given user:</p>
  
  <pre><code>@property
  def commented_posts(self):
    return Post.query.join(Comment, Comment.post_id==Post.id).filter(Comment.author_id==self.id)
  </code></pre>