title: Flask SQLAlchemy querying a column with "not equals"
body: <p>I can query my <code>Seat</code> table for all seats where there is no invite assigned:</p>
  
  <pre><code>seats = Seat.query.filter_by(invite=None).all()
  </code></pre>
  
  <p>However, when querying for all seats that have an invite assigned, I get a <code>NameError</code>:</p>
  
  <pre><code>seats = Seat.query.filter_by(invite!=None).all()
  </code></pre>
  
  <pre class="lang-none prettyprint-override"><code>NameError: name 'invite' is not defined
  </code></pre>
  
  <p>Here is my <code>Seat</code> class:</p>
  
  <pre><code>class Seat(db.Model):
      id = db.Column(db.Integer, primary_key=True)
  
      invite_id = db.Column(db.Integer, db.ForeignKey('invite.id'))
      invite = db.relationship('Invite',
          backref=db.backref('folks', lazy='dynamic'))
  </code></pre>
  
  <p>How can I query for all seats where the owner is not blank?</p>