I'm guessing you probably want to use an Association Object. Please read this and see if it's what you need:
<http://www.sqlalchemy.org/docs/datamapping.myt#datamapping_association> You can specify order_by in the relation(), and then the ordering is automatic. HTH. --i On Feb 1, 2007, at 5:01 PM, iain duncan wrote: > > I've been experimenting with no luck, so perhaps someone has a pointer > on this, using assign_mapper: > > - I have a table of pages and articles, > - many-to-many table of pages_articles that includes a third column > for > 'ordering' which is meant to be used to control the order an > instance is > retrieved in > > - I want to be able to say "select articles where page.id=2, order by > ordering" > > I made an empty class for Page_Article in order to use the third > column, > and I added an integer primary key to the page_article table, though I > would rather make the combination of page to article be the primary > key. > But I figured I could tackle that later. > > I'm quite lost as to what should go where in terms of the mappers. > This > is what I currently have: > > # article mapper > assign_mapper( session.context, Article, article_table, > properties = { "ordering": relation(Page_Article) } ) > > # page mapper with m-to-m relation on articles > assign_mapper(session.context, Page, page_table, properties = { > "articles": relation(Article, secondary=page_article_table, > backref="pages", lazy=False)}) > > assign_mapper( session.context, Page_Article, page_article_table ) > > Any tips much appreciated! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TurboGears" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/turbogears?hl=en -~----------~----~----~----~------~----~------~--~---

