On Friday, September 26, 2014 7:42:07 PM UTC-4, Michael Bayer wrote:
>
> well those import targets change with major releases and also sphinx 
> doesn’t make it easy to talk about import targets that might be in more 
> than one place…probably a problem to be solved 
>

if sqlalchemy.sql.selectable should be the new docstrings, I can make a PR 

> * orm.query.Query.cte() - the docs don't say what it returns (though it 
> hits at a CTE compatible object).  It returns a 
> sqlalchemy.sql.selectable.CTE, which has the same interface as 
> sqlalchemy.sql.expression.CTE 
>

same here.  would be happy to standardize the docs on this, as I've been 
flipping around them like a madman.

I think i finally have this figured out.  

my production example was more in the form of:
 
    sq_1 = sess.query(A.id.label('id_sq1')).subquery('sq1')
    sq_1b = sess.query(sq_1.c.id_sq1).subquery('sq1b')
    sq_2 = sess.query(A.id.label('id_sq2')).subquery('sq2')
    sq_2b = sess.query(sq_2.c.id_sq2).subquery('sq2b')

    # `union` generates a `sqlalchemy.sql.selectable.CompoundSelect`
    _compound_select = union(sq_1b.select(), sq_2b.select())

and both of these will appear to create the sql I need

    print sess.query(A.id).select_entity_from(_compound_select)
    print sess.query(sq_1.c.id_sq1).select_entity_from(_compound_select)

depending on how i generated the `_compound_select` ( as-is, `alias`, 
`subquery`, etc ) I would need to adjust what I query; and depending on 
what I query, it would either not have targetable columns, create invalid 
SQL ( some forms would generate "AS anon_1 AS anon_2" ie, without a parens 
), or build a query that seems to query itself recursively.  hard to 
describe that last one otherwise.

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to