its not theoretically impossible, but it is theoretically ridiculously complicated to do automatically, and also would have to limit the depth arbitrarily to one or two levels (which means, someone wants level 5 off their eager loader, then they come back to complain). each level of nodes for an adjacency-list relationship requires a distinct self-join. each self-join would need to be aliased too, which then gets pretty complicated when that self-join is injected into a larger mapping of enclosing eager loaders, etc. plus all the code that right now knows "stop eager loading when we come back to our own mapper" now becomes a lot more complicated, since now we are counting levels and stuff like that. add onto that the really insane self-joins that already arise with polymorphic mappings, id be fixing bugs in that code for ten years. the queries are way too huge. not to mention the efficiency issues that start to arise when you start self-joining too much.
So, if you really need to load alot of self-ref nodes in one query, you query all the nodes yourself and then attach them. thats what the example "examples/adjacencytree/byroot_tree.py" illustrates. On Mar 23, 2007, at 12:14 PM, Koen Bok wrote: > > Could anyone please explain me a little why self referantial mappers > cannot be eager-loading. Is this not yet integrated in SQLAlchemy or > theoratically impossible or impractical? > > Ciao > > Koen > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---