Hi,

When wrapping a query with an enclosing query to add columns computed from 
the original query's columns, I'm blatantly doing this:

        order_clause_list = ClauseList(*fact_query._order_by_clause)
        fact_query._order_by_clause = ClauseList()
        subq = fact_query.alias('forperc')
        return select(
            [subq.c[k] for k in subq.c.keys()] + [
                <extra columns based on subq's columns>
                for dim in percentage_dims
                ]
            ).order_by(*order_clause_list)

since I want the original query's ordering, and subquery ordering is not 
guaranteed to be maintained.

This works (in 0.7.5). But it messes with internals (_order_by_clause). So 
is there a more proper way to do this (for general queries), against the 
public sql.expression API?

Regards,

Gulli

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/sqlalchemy/-/HlBjhxwBMxQJ.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to