Hi Anthony,

Thanks for replying.
I already withdrew all references to cache to make sure it is not the cause 
of the problem. But... it's the same.

Dominique

Le vendredi 21 novembre 2014 16:50:04 UTC+1, Anthony a écrit :
>
> The .sort() method is done in Python and has nothing to do with SQLite. 
> That makes me think something else is going on, such as something being 
> cached and therefore not updating with your code changes.
>
> Anthony
>
> On Friday, November 21, 2014 9:32:00 AM UTC-5, Dominique wrote:
>>
>> Hello,
>>
>> I have a small personal website published on PythonAnywhere.
>> PythonAnywhere upgraded SQLITE some time ago.
>> Since then, one query doesn't work anymore. 
>>
>> It is a query with a many to many relationship and the select should give 
>> results at random.
>> rows = db(...).select(..., orderby='<random>')
>> It doesn't return me a random set of rows but rather always the same 
>> rows, starting from the beginning of the possible matching rows. 
>>
>> I tried to address the problem without success. 
>>
>> I also tried not using the web2py dialect and replacing it with 
>>
>> import random
>> rows=db(...).select().sort(lambda row: random.random())
>>
>>
>> as explained in the web2py doc. No success either.
>>
>> I also replaced the query with explicit SQL statement using 
>> db.executesql( SELECT.....ORDER BY RANDOM() )
>>
>> No success !
>>
>> I downloaded the database onto my home pc and tested with the same 
>> website in local.
>> It works perfectly at home.
>>
>> I tested on PythonAnywhere another model (based on the docs 
>> http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Many-to-many
>> ).
>> It works fine returning results randomly. So it seems the upgrade of 
>> SQLite done by PythonAnywhere is not responsible for the problem.
>>
>> Does anybody have an idea what's going on, why the query doesn't work on 
>> PythonAnywhere and works locally ?
>>
>> Thanks for any hint 
>> Dominique
>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to