Just noticed that for mappers that use tables that do not define foreign keys, specifying only 'primaryjoin=' plus 'foreign_keys=' doesn't seem to be sufficient to define the relationship, adding 'remote_side=' fixed it.
Also for such mappers, if there is a 'backref', the backref doesn't seem to be able to use the foreign key relationships for the mapper, it wants the 'primaryjoin=', 'foreign_keys=' and 'remote_side=' to be specified all over again. Quick example: t = table('test', meta, Column('id', INT, primary_key=True, nullable=False), Column('idparent', INT) # Note FK ommitted, MySQL/MSSQL self-table FK delete cascade bug workaround ) class Foo: pass mapper(Foo, t, properties: {'children': relation(Foo, primaryjoin = t.c.idparent = t.c.id, foreign_keys=[t.c.idparent], backref='parent' }) won't work until you add more attributes as per above. Shouldn't this definition be enough? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---