In the hope that the recently mentioned possibility of problems with the list has prevented replies, I am forwarding this message that I posted earlier today.

---------- Forwarded message ----------
From: Jonathon Anderson <>
Date: Jul 26, 2006 10:43 AM
Subject: relation attributes

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 ( () and List.items()); second, the ListItem class requisites an extra column.

Any thoughts on this issue would be greatly appreciated.

~jonathon anderson

~jonathon anderson