On Sep 24, 2014, at 10:13 PM, Jonathan Vanasco <[email protected]> wrote:
> preface: I can post an example if needed (already made it to figure out this
> was the problem)
>
> i have 2 similar queries, each containing a CTE, which are then joined by a
> union
>
> a very abbreviated version of each one is this:
>
> cte_Stream1 = s.query(
> Foo.id.label('id'),
> Bar.event_timestamp.label('event_timestamp'),
> )\
> .cte(name="cte_steam_1")
> query_Stream1 = s.query(
> cte_Stream1.c.id,
> cte_Stream1.c.event_timestamp,
> )
> cte_Stream2 = s.query(
> Foo.id.label('id'),
> Bar.event_timestamp.label('event_timestamp'),
> )\
> .cte(name="cte_steam_2")
> query_Stream2 = s.query(
> cte_Stream2.c.id,
> cte_Stream2.c.event_timestamp,
> )
> _unioned = sqlalchemy.union_all(query_Stream1, query_Stream2)
>
> the only way I am able to operate on _unioned (orders, selects, joins,
> filters, etc) is by addressing the `cte_Stream1.c.id` and
> `cte_Stream1.c.event_timestamp`.
>
> this sort of makes sense, and sort of doesn't. i just wanted to make sure I
> am doing this right.
probably, those CTEs are the "tables" you're selecting from ultimately.
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.