Re: [SQLObject] orderBy table.q.attribute
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Ian B. <ia...@co...> - 2004-04-23 16:18:59
|
Oleg Broytmann wrote: > On Fri, Apr 23, 2004 at 07:48:06PM +0400, Oleg Broytmann wrote: > >>On Fri, Apr 23, 2004 at 05:22:00PM +0200, Philippe Normand wrote: >> >>>And, still the dash doesn't make sense to me >>>because orderBy has to be a string, not a number. Anyway ... > > > Let do it with strings: > > patients = Patient.select(None, orderBy="-registration_time") > > Traceback (most recent call last): > [snip] > File "/usr/local/lib/python2.3/site-packages/SQLObject/DBConnection.py", line 168, in _iterSelect > cursor.execute(query) > ProgrammingError: ERROR: Non-integer constant in ORDER BY > > SELECT ... ORDER BY 'registration_time' DESC > > See? SQLObject have added excessive apostrophes to the column name :( Huh... this is exactly what happens in SliceTest and NamesTest: self.counterEqual(Counter.select('all', orderBy='number'), range(100)) self.assertEqual([(n.fname, n.lname) for n in Names.select().orderBy(['fname', 'lname'])], [('aj', 'baker'), ('joe', 'baker'), ('joe', 'robbins'), ('tim', 'jackson'), ('zoe', 'robbins')]) And those work and don't quote their arguments. Should it be "-registrationTime"? Both should work, but maybe they don't. Ian |