I've mentioned this before, but I thought that, rather than a simple question, the issue might deserve full discussion.

There needs to be a better way to model a many-to-many relationship with relational attributes.

Lets have an example:

--database schema--

| id
| name

| id
| name

| list_id
| item_id
| position


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