Thanks!

Very simple solve :)

I just added:
def content_comments_level_add(mapper, context, row, target, **flags):
    if mapper.class_ is Comment and 'AS level' in context.query.__str__():
        level = tuple(row)[-3]
        target.level = level



event.listen(mapper, 'populate_instance', content_comments_level_add)

and it works.

Thanks!


On Thu, Oct 20, 2011 at 6:54 PM, Michael Bayer <mike...@zzzcomputing.com>wrote:

>
> On Oct 20, 2011, at 10:45 AM, Alex K wrote:
>
> > I solve this problem with new custom Query class:
>
> it appears all you're doing is injecting an extra column into the result.
>  Still not clear why column_property() doesn't work here.  There's also the
> populate_instance event which would allow you to inject code right into the
> load operation, given the "row" and "instance" you're looking for here:
> http://www.sqlalchemy.org/docs/orm/events.html#sqlalchemy.orm.events.MapperEvents.populate_instance.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "sqlalchemy" group.
> 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.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
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