I am trying to build a self-referential mapper like the basic_tree
example, but would like to be able to access the root of any given
TreeNode, much like the now depreciated and tricky byroot_tree.py.
Before you tell me just to use the byroot_tree, zzzeek has already
told me to work with eager loading and the byroot_tree has some issues
loading currently.

http://svn.sqlalchemy.org/sqlalchemy/tags/rel_0_5beta3/examples/adjacencytree/basic_tree.py
http://svn.sqlalchemy.org/sqlalchemy/tags/rel_0_5beta3/examples/adjacencytree/byroot_tree.py

So here is my issue: whenever I try to modify basic_tree to keep track
of root_id's and map the root property I run into the following
problem:

   "ArgumentError: Could not determine join condition between parent/
child tables on relation Node.children.
   Specify a 'primaryjoin' expression.  If this is a many-to-many
relation, 'secondaryjoin' is needed as well."

Note, this is even when I use a primaryjoin similar to the byroot
example:

    root=relation(Node, primaryjoin=trees.c.root_id==trees.c.id,
                  remote_side=trees.c.id, lazy=None)

Can anyone help me convert the eager loading example to allow root
access? This is particularly important because every time I load a
TreeNode, I want to be able to access the root, and I also want to be
able to retrieve all the TreeNodes for a given root_id.

Thank you,
Tom

--~--~---------~--~----~------------~-------~--~----~
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 more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to