[sqlalchemy] Re: self-referential table question

2008-01-28 Thread Steve Zatz
> another option is: > .query(Node).filter(not_(Node.id.in_(select([Node.parent_id] jason, thanks for the alternative method. Steve --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to

[sqlalchemy] Re: self-referential table question

2008-01-28 Thread jason kirtland
Steve Zatz wrote: > I realize this is actually an SQL question but I haven't been able to > figure out the answer. > > In a simple self-referential table, the following produces all the > Nodes that are parents to some child node(s): > > node_table_alias = node_table.alias() > parents = session.

[sqlalchemy] Re: self-referential table question

2008-01-28 Thread Steve Zatz
Michael, Works perfectly. Thanks much. Steve --~--~-~--~~~---~--~~ 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

[sqlalchemy] Re: self-referential table question

2008-01-27 Thread Michael Bayer
On Jan 27, 2008, at 8:06 PM, Steve Zatz wrote: > > I realize this is actually an SQL question but I haven't been able to > figure out the answer. > > In a simple self-referential table, the following produces all the > Nodes that are parents to some child node(s): > > node_table_alias = node_tab

[sqlalchemy] Re: self-referential table question

2006-12-02 Thread Steve Zatz
Works. Thanks. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For

[sqlalchemy] Re: self-referential table question

2006-12-02 Thread Michael Bayer
whoops, lazy loaders needed awareness of that new parameter too, try rev 2125. --~--~-~--~~~---~--~~ 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

[sqlalchemy] Re: self-referential table question

2006-12-02 Thread Steve Zatz
Oops, I may have spoken too soon about things working... The children relationship works fine and generates the correct query. However, I don't think that the parent backref relationship is generating the right query. item0.parent produces the following where clause: ... WHERE ? = item.parent_

[sqlalchemy] Re: self-referential table question

2006-12-02 Thread Steve Zatz
Works perfectly. Your responsiveness and the usefulness of SQLAlchemy continue to amaze. Thanks. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@g

[sqlalchemy] Re: self-referential table question

2006-12-01 Thread Michael Bayer
yeah... update to SVN 2124 and set up your mapper like this: mapper(Item, item_table, properties = dict(children = relation(Item, remote_side=[item_table.c.parent_uuid], backref=backref('parent', remote_side=[item_table.c.uuid])), )) the "remote_side" argument will now be used to specify which