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.query(Node).filter(Node.id == node_table_alias.c.parent_id)

I can't figure out the analogous query that produces all the Nodes
that are not parents to another node.  It is clear that:

non_parents = session.query(Node).filter(Node.id !=
node_table_alias.c.parent_id)

doesn't work but I can't figure out what the right query is.  Any help
would be appreciated.

Steve

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to