title: Alias an sqlalchemy.text object
body: <p>Im trying to allow users to input query in the UI and then add it to the FROM clause of my sqlalchemy.
  After seeing the <code>from_self</code> function on the query object in the <a href="https://docs.sqlalchemy.org/en/latest/orm/query.html" rel="nofollow noreferrer">docs</a>, I tried:</p>
  
  <pre><code>Query.from_statement(text("select * from test_table")).from_self()
  </code></pre>
  
  <p>and:</p>
  
  <pre><code>alias(text("select * from test_table"), name="some_name")
  </code></pre>
  
  <p>and:</p>
  
  <pre><code>text("select * from test_table").label(name="some_name")
  </code></pre>
  
  <p>None of these worked. 
  Im trying to get a query like this:</p>
  
  <pre><code>(SELECT * FROM test_table) AS some_name
  </code></pre>