Patches item #1450564, was opened at 2006-03-15 20:52
Message generated for change (Comment added) made by phd
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=540674&aid=1450564&group_id=74338
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
>Status: Open
>Resolution: Invalid
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Nobody/Anonymous (nobody)
Summary: Limit keyword does not with orderBy
Initial Comment:
When performing a select query over a table, the limit
keyword will not be used if orderBy is specified. For
example,
class Test(SQLObject):
total IntCol(notNull=True)
# create SQL connection and stuff
...
res = Test.select(orderBy='total', limit=10)
The results will contain every row from Test, since the
resultant SQL query is similar to
"SELECT id, total FROM test ORDER BY total"
No LIMIT attribute is ever specified. Looking at the
code, this is because limit will only work when used
with the start or end keyword.
----------------------------------------------------------------------
>Comment By: Oleg Broytmann (phd)
Date: 2006-03-21 12:57
Message:
Logged In: YES
user_id=4799
Please add documentation and tests.
----------------------------------------------------------------------
Comment By: Oleg Broytmann (phd)
Date: 2006-03-21 12:53
Message:
Logged In: YES
user_id=4799
The query should be
res = Test.select(orderBy='total')[:10]
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=540674&aid=1450564&group_id=74338
|