Re: [SQLObject] Automatic expressions to allow for arbitrary orderBy clause
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Brian C. <br...@te...> - 2007-07-25 20:36:48
|
On 7/25/07, Luke Opperman <lu...@me...> wrote: > It's missing something, presumably you want to return the traversed FKs (or > their .q expression) in addition to the classes found in the search (building > the expressions as X.id == Y.id will not get the results intended, you want > X.fkToYID == Y.id). I'd probably let .q handle more of the work in > BuildJoinExpression too, so for instance: Thanks for the advice, I didn't like having to drop down in sqlbuilder. Using .q makes it a lot more readable. > --- > > Using .q notation for traversing Joins and FKs is in trunk, so the non-automated > way to address your problem is much simpler now: > > Foo.select(AND(Foo.q.bar, Bar.q.blah), orderBy=Blah.q.sortme) > > or equivalently if you define the matching SQL*Joins: > > Foo.select(AND(Bar.q.foos, Blah.q.bars), orderBy=Blah.q.sortme) Do you still have to specify all the intermediate tables? I have one join I need to make that uses 5 tables (and I would prefer to avoid thinking about the relational chain if I can). Plus if you change your relational structure, can the AND method appropriately adapt at runtime? Or is it fixed whenever you write it? Thanks, Brian |