There needs to be a better way to model a many-to-many relationship with relational attributes.
Lets have an example:
--database schema--
item
| id
| name
list
| id
| name
list_item
| list_id
| item_id
| position
--sqlobject--
class Item (SQLObject):
| name = StringCol(alternateID=True, length=80)
| lists = RelatedJoin('List', intermediateTable='list_item')
class List (SQLObject):
| name = StringCol(alternateID=True, length=80)
| items = RelatedJoin('Item', intermediateTable='list_item')
class ListItem (SQLObject):
| sqlmeta:
| | table = 'list_item'
|
| item = ForeignKey('Item')
| list = ForeignKey('List')
| position = IntCol()
| uniquePositionPerList = DatabaseIndex('position', 'list', unique=True)
These demonstrate an ordered list containing multiple items, and these items can exist in multiple lists (even multiple times in the same list). The thing is, I should not have to create the ListItem class to use position: there should be some way to define it as an attribute of the RelatedJoin.
I believe this is an important issue for two reasons: first, the addition of an extra class reduces the clarity of the object model by having two ways to access a group's items that have different capabilities (ListItem.select () and List.items()); second, the ListItem class requisites an extra list_item.id column.
Any thoughts on this issue would be greatly appreciated.
--
~jonathon anderson
------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________ sqlobject-discuss mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss
