Hello,

I'm looking into something a bit tricky : having a relation between a
table and itself (an adjacency list then) with a non-trivial join
condition.
Let's say for example, in the case of a Checkers game board for
example, to query the neighboring tiles of a given tile. To do the
query itself is easy, but then it can't be eagerloaded which is a
shame...

I tried something like (with a "stupid" condition) :
table_alias = mytable.alias()
mapper(Tile, mytable, properties={
 'neighbors' = relation(Tile, primaryjoin=mytable.c.x >
table_alias.c.x,
                                       foreign_keys=[mytable.c.x],
                                       viewonly=True)
})

but that does not do what I could expect : it queries both tables
(normal and aliased) but returns result from the non-alias table
(without eagerloading) or fails (with eagerload) because it uses
incoherent aliased tables.

The problem comes from we have no access to the table being
automatically aliased when doing an adjacency relation here ; and
building a new aliased table is a non-sense.

In one word : HELP !

Gus
--~--~---------~--~----~------------~-------~--~----~
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