Am 28.07.2011 00:41 schrieb Michael Bayer:
order_by() is accepting SQL expressions, not values, so it is
consistent that values should be coerced to SQL first in this case
literal_column("1"), etc.
My thought was that if order_by automatically coerces strings, i.e.
order_by('1') works, then it should also coerce integers automatically
since these have a well-defined meaning here. Of course this coercion
should be done for order_by and group_by only, not everywhere.
I'm not actually understanding what "ORDER BY 1" is getting you here
in any case or how this relates to AJAX.
Just a practical example for when ordering by ordinal position can be
useful. If you have many AJAX autosuggest fields, fed by the results of
various queries, you could postprocess all of these queries with the
simple common code query.order_by(1).limit(10) instead of ordering all
queries individually.
-- Christoph
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" 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/sqlalchemy?hl=en.