Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#141 n:m join of a table with itself overwrites methods

open
nobody
None
5
2013-01-18
2005-12-18
Matthias Urlichs
No

I'm trying to do a n:m join of a table with itself.

Unfortunately, the accessor methods are named only by
the referenced table and thus get overwritten.

The same problem would occur if I had two *different*
RelatedJoins between two tables, which is not at all
unheard-of.

class ACLUser(sql.SQLObject):
"""\ This class represents a user (or group).

Names are not necessarily unique; for the most
part, visibility
rules control which ACLs anybody can see.
"""
name = sql.StringCol(length=40, notNone = True)

groups = sql.RelatedJoin('ACLUser',
joinColumn='user_id',
otherColumn='group_id',
intermediateTable='acl_roles')
members = sql.RelatedJoin('ACLUser',
joinColumn='group_id',
otherColumn='user_id',
intermediateTable='acl_roles',
createRelatedTable=False)

Discussion