Hi, I am currently trying to make a relation between Document and Author, where there is a many to many association which is dealt with by a secondary table and I am trying to store the position of an author in the author list. mapper(Paper, document_table, properties={'journal':relation(Journal, backref='paper'), 'authors':relation(Author, secondary=papers_to_authors_table,
collection_class=ordering_list('position'), order_by=[papers_to_authors_table.c.position]), 'keywords':relation(Keyword, secondary=documents_to_keywords_table) }) papers_to_authors_table = Table('p2a_association', metadata, Column('document', Integer, ForeignKey('documents.document_id')), Column('author', Integer, ForeignKey('authors.author_id')), Column('position', Integer) ) However when I try to do this: File "Worker.py", line 281, in <module> p = Paper(title, date, authors, journal, j_volume, j_issue, keywords, abstract, None, body, pmid, institution) File "/cluster/soft/Linux_2.6_64/lib/python2.5/site-packages/SQLAlchemy-0.4.8-py2.5.egg/sqlalchemy/orm/attributes.py", line 1218, in init oldinit(instance, *args, **kwargs) File "/cluster/home/nathan/work/workspace/txtmining/Registry.py", line 258, in __init__ self.authors.append(a) File "/cluster/soft/Linux_2.6_64/lib/python2.5/site-packages/SQLAlchemy-0.4.8-py2.5.egg/sqlalchemy/orm/collections.py", line 922, in append fn(self, item) File "/cluster/soft/Linux_2.6_64/lib/python2.5/site-packages/SQLAlchemy-0.4.8-py2.5.egg/sqlalchemy/ext/orderinglist.py", line 214, in append self._order_entity(len(self) - 1, entity, self.reorder_on_append) File "/cluster/soft/Linux_2.6_64/lib/python2.5/site-packages/SQLAlchemy-0.4.8-py2.5.egg/sqlalchemy/ext/orderinglist.py", line 202, in _order_entity have = self._get_order_value(entity) File "/cluster/soft/Linux_2.6_64/lib/python2.5/site-packages/SQLAlchemy-0.4.8-py2.5.egg/sqlalchemy/ext/orderinglist.py", line 189, in _get_order_value return getattr(entity, self.ordering_attr) AttributeError: 'Author' object has no attribute 'position' So is there an easy way of performing this functionality using the ordered list or do I need to do something else? Many thanks in advance nathan --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---