On Saturday, November 2, 2013 10:53:18 AM UTC-4, Michael Bayer wrote:
>
> great query. CTE’s work surprisingly well with the select_entity_from()
> method, which typically adds another level of SELECT but with CTE in this
> case produces the equivalent statement. Note that the type_coerce() on
> breadcrumbs is because query() wants return values to be hashable when
> entities are present:
>
> result = session.query(
> Division,
> hierarchy.c.level,
> type_coerce(hierarchy.c.breadcrumbs,
> ARRAY(Integer, as_tuple=True)),
>
> ).select_entity_from(hierarchy).order_by('breadcrumbs').all()
>
It works perfectly that way, thank you and I updated the gist with the
correct solution.
Bérenger
--
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/groups/opt_out.