[Sqlalchemy-tickets] [sqlalchemy] #2848: RowProxy don't get sorted as expected
Brought to you by:
zzzeek
|
From: sqlalchemy <mi...@zz...> - 2013-10-21 13:01:10
|
#2848: RowProxy don't get sorted as expected
-------------------------+-----------------------------------------
Reporter: pakal | Owner: zzzeek
Type: defect | Status: new
Priority: medium | Milestone:
Component: cextensions | Severity: no triage selected yet
Keywords: | Progress State: awaiting triage
-------------------------+-----------------------------------------
If one uses raw queries like this:
res = list(session.execute("SELECT a,b FROM my_subscription"))
then we see (by printing) that res is [(0L, 13209L), (1L, 7057L), (2L,
410L), (10L, 3L), (6L, 10L)]
But these aren't tuples, so when we try to sort() that list (or use
sorted() on it), records just get weirdly mixed up.
I guess RowProxy objects should have the same behaviour as tuples when it
comes to sorting, or else they should display themselves as objects
instead of tuples, to avoid confusing unexperienced users.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2848>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|