title: How to TABLESAMPLE with SQLAlchemy?
body: <p>Is it currently possible to <code>TABLESAMPLE</code> on some of the tables in an ORM query in SQLAlchemy?</p>
  
  <p>The closest I could find is <a href="http://docs.sqlalchemy.org/en/latest/orm/query.html#sqlalchemy.orm.query.Query.suffix_with" rel="nofollow"><code>Query.suffix_with(*suffixes)</code></a>, but that places the suffix on the end of the query, rather than on the end of a table.</p>
  
  <p>If it helps, this is my use case:</p>
  
  <p>My query is currently:</p>
  
  <pre><code>query = session.query(A).options(
      subqueryload(A.rel1),
      subqueryload(A.rel2)
  ).filter(A.id &gt;= min_id, A.id &lt; max_id, [...]) 
  </code></pre>
  
  <p>and I would like to <code>TABLESAMPLE</code> on the table <code>A</code> so that I could efficiently load only a subset of <code>A</code> and their corresponding relations, with some filters. I am using PostgreSQL 9.5 as my database.</p>