Menu

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

open
nobody
None
5
2013-01-18
2005-12-18
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


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.