title: How to execute raw SQL in Flask-SQLAlchemy app
body: <p>How do you execute raw SQL in SQLAlchemy?</p>
  
  <p>I have a python web app that runs on flask and interfaces to the database through SQLAlchemy. </p>
  
  <p>I need a way to run the raw SQL. The query involves multiple table joins along with Inline views. </p>
  
  <p>I've tried:</p>
  
  <pre><code>connection = db.session.connection()
  connection.execute( &lt;sql here&gt; )
  </code></pre>
  
  <p>But I keep getting gateway errors.</p>