title: Flask-SQLAlchemy check if row exists in table
body: <p>I have a Flask application which uses Flask-SQLAlchemy to connect to a MySQL database.</p>
  
  <p>I would like to be able to check whether a row is present in a table. How would I modify a query like so to check the row exists:</p>
  
  <pre><code>db.session.query(User).filter_by(name='John Smith')
  </code></pre>
  
  <p>I found a solution on <a href="https://stackoverflow.com/a/13336408/2961662">this question</a> which uses SQLAlchemy but does not seem to fit with the way Flask-SQLAlchemy works:</p>
  
  <pre><code>from sqlalchemy.sql import exists    
  print session.query(exists().where(User.email == '...')).scalar()
  </code></pre>
  
  <p>Thanks.</p>