title: SqlAlchemy core union_all not adding parentheses
body: <p>I have the following sample code:</p>
  
  <pre><code>queries = []
  q1 = select([columns]).where(table.c.id == #).limit(#)
  queries.append(q1)
  q2 = select([columns]).where(table.c.id == #).limit(#)
  queries.append(q2)
  
  final_query = union_all(*queries)
  </code></pre>
  
  <p>The generated SQL should be this:</p>
  
  <pre><code>(select columns from table where id = # limit #)
  UNION ALL
  (select columns from table where id = # limit #)
  </code></pre>
  
  <p>But, I'm getting</p>
  
  <pre><code>select columns from table where id = # limit #
  UNION ALL
  select columns from table where id = # limit #
  </code></pre>
  
  <p>I tried using <code>subquery</code>, as follows for my queries:</p>
  
  <pre><code>q1 = subquery(select([columns]).where(table.c.id == #).limit(#))
  </code></pre>
  
  <p>The generated query then looks like this:</p>
  
  <pre><code>SELECT UNION ALL SELECT UNION ALL
  </code></pre>
  
  <p>I also tried doing</p>
  
  <pre><code>q1 = select([columns]).where(table.c.id == #).limit(#)).subquery()
  </code></pre>
  
  <p>But, I get the error:</p>
  
  <pre><code>'Select' object has no attribute 'subquery'
  </code></pre>
  
  <p>Any help to get the desired output with my subqueries wrapped in parentheses?</p>
  
  <p>Note: this is not a duplicate of this <a href="https://stackoverflow.com/questions/14673060/sqlalchemy-union-parenthesis-issue">question</a>, because I'm not using Session. </p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Okay, this <em>works</em>, but I don't believe it is very efficient, and it's adding an extra <code>select * from (my sub query)</code>, but it works.</p>
  
  <pre><code>q1 = select('*').select_from((select(columns).where(table.c.id == #).limit(#)).alias('q1'))
  </code></pre>
  
  <p>So, if anyone has any ideas to optimize, or let me know if this is as good as it gets. I would appreciate it.</p>