On Tue, 2007-06-02 at 06:25 -0200, Roger Demetrescu wrote: > Hi iain > > On 2/5/07, iain duncan <[EMAIL PROTECTED]> wrote: > > Below is my code in case someone has time to look at it. At the moment it > > works to get > > article.ordering as a list instead of one field. Is there a way to tell it > > that this is only supposed to be one item? > > uselist is your friend.. :)
Great, that did it. ( It's actually on the ordering field that I needed it, but it worked ). Now after selecting and article I can use ordering directly as a field: [(a.article_name, a.ordering ) for a in Article.select_by(page_id=2)] One thing I'm still not clear on is whether I can do an order_by on an object field, or whether that always needs to be with the select on table notation like so: arts = Article.select(page_table.c.page_id==2, order_by=[page_article_table.c.ordering]) Is there someway to do the above like one of these but with ordering added now that ordering is accessible as either page_article_table.c.ordering or Article.ordering: arts = Article.select_by(page_id=2) arts = Page.get(2).articles A big thanks to the makers of association proxy and session context and assign mapper! Thanks Iain --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---