Re: [SQLObject] orderBy table.q.attribute
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Philippe N. <sw...@fr...> - 2004-04-23 16:17:48
|
On Fri, Apr 23, 2004 at 07:53:29PM +0400, 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 ... >=20 > Let do it with strings: >=20 > patients =3D Patient.select(None, orderBy=3D"-registration_time") >=20 > 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 >=20 > SELECT ... ORDER BY 'registration_time' DESC >=20 > See? SQLObject have added excessive apostrophes to the column name :( >=20 > Oleg. Quoting the online doco (http://sqlobject.org/docs/SQLObject.html): "You can use the keyword arguments orderBy to create ORDER BY in the select statements: orderBy takes a string, which should be the database name of the column, or a column in the form Person.q.firstName." Cheers --=20 Philippe Normand |