Re: [web2py] Re: orderby='' on Google App Engine

2011-11-25 Thread Bruno Rocha
On Fri, Nov 25, 2011 at 11:46 PM, howesc wrote: > looks like the exception there is because your query has an OR condition > in it, which is not supported on GAE. that sort should be in-memory and > should work fine. > I found, the error was because of the use of contains() in query -- Brun

Re: [web2py] Re: orderby='' on Google App Engine

2011-11-25 Thread howesc
looks like the exception there is because your query has an OR condition in it, which is not supported on GAE. that sort should be in-memory and should work fine.

Re: [web2py] Re: orderby='' on Google App Engine

2011-11-24 Thread Bruno Rocha
Isn't random sort suported in GAE ? * rows = db(query).select().sort(lambda row: random.random()) > File > "/base/data/home/apps/s~movucahq/0-1.354917246392574252/gluon/dal.py", line > 5789, in select > return self.db._adapter.select(self.query,fields,attributes) > File > "/base/data/home/apps/s~

[web2py] Re: orderby='' on Google App Engine

2010-12-09 Thread howesc
as far as i know you would have to write some custom big table queries (not using web2py dal). but in theory you could: - write a direct query to get all the keys of a table (and no data) - cache those keys - randomly choose a set of keys from the full list - write a google key query. google is no

[web2py] Re: orderby='' on Google App Engine

2010-12-08 Thread Richard
ah OK. Anyway, how could this be done server-side when also using limit? I want to show some random records without querying all the data.

Re: [web2py] Re: orderby='' on Google App Engine

2010-12-08 Thread Albert Abril
Massimo is correct, I just wanted to know the more efficient way to randomize a Rows dictionary, instead of using orderby=. Because as said on the book, orderby= is not supported on GAE. Just easy as using python random library :) Thanks again. On Wed, Dec 8, 2010 at 1:04 AM, mdipierro wrote:

[web2py] Re: orderby='' on Google App Engine

2010-12-07 Thread mdipierro
He asked: "Someone knows the best way to randomize a Rows dictionary?" The proposed solution randomized the Rows object that you already fethed form the db. You are correct that it does not fetch random rows. On Dec 7, 4:41 pm, Richard wrote: > I think he's after an database-side implementation.

[web2py] Re: orderby='' on Google App Engine

2010-12-07 Thread Richard
I think he's after an database-side implementation. If you used limit and random together then wouldn't you always get the same set of data, rather than random? On Dec 8, 4:13 am, mdipierro wrote: > Not sure I understand our comment: > > rows=db(...).select().sort(lambda row: random.random()) >

[web2py] Re: orderby='' on Google App Engine

2010-12-07 Thread mdipierro
Not sure I understand our comment: rows=db(...).select().sort(lambda row: random.random()) sorts the rows that have been already fetched at the web2py/python level. That is all. What is wrong with it? On Dec 7, 9:28 am, blackthorne wrote: > Seems to be 1.89.5 (2010-11-21 16:03:13).. > > but wh

[web2py] Re: orderby='' on Google App Engine

2010-12-07 Thread blackthorne
Seems to be 1.89.5 (2010-11-21 16:03:13).. but what about my comment of the random sorting? On Dec 7, 3:09 pm, mdipierro wrote: > You have an old version. aidr is a type fixed some time ago. > > On Dec 7, 7:13 am, blackthorne wrote: > > > > > I don't see howcome this works as random sorting. >

[web2py] Re: orderby='' on Google App Engine

2010-12-07 Thread mdipierro
You have an old version. aidr is a type fixed some time ago. On Dec 7, 7:13 am, blackthorne wrote: > I don't see howcome this works as random sorting. > The only random thing I see it's the row chosen for sorting which will > only change the sorting criteria for the number of rows in the table. >

[web2py] Re: orderby='' on Google App Engine

2010-12-07 Thread blackthorne
I don't see howcome this works as random sorting. The only random thing I see it's the row chosen for sorting which will only change the sorting criteria for the number of rows in the table. Am I wrong? P.S.: I couldn't make a quick test because: isco-Ribeiros-MacBook-Pro-2:web2py blackthorne$ py

[web2py] Re: orderby='' on Google App Engine

2010-12-07 Thread cjrh
On Dec 7, 1:16 am, Albert Abril wrote: > I didn't know i could use imports in GAE > Thank you Massimo. Book updated to reflect Massimo's answer. I thought it best to emphasize the technique of using imports in these situations.

[web2py] Re: orderby='' on Google App Engine

2010-12-06 Thread mdipierro
and you can put your own modules in web2py/site-packages and they will be deployed with your app. On Dec 6, 5:16 pm, Albert Abril wrote: > I didn't know i could use imports in GAE > Thank you Massimo. > > On Mon, Dec 6, 2010 at 11:53 PM, mdipierro wrote: > > import random > > ... > > rows=db(...

Re: [web2py] Re: orderby='' on Google App Engine

2010-12-06 Thread Albert Abril
I didn't know i could use imports in GAE Thank you Massimo. On Mon, Dec 6, 2010 at 11:53 PM, mdipierro wrote: > import random > ... > rows=db(...).select().sort(lambda row: random.random()) > > On Dec 6, 4:09 pm, Albert Abril wrote: > > Hi! > > > > As said on the book, in a DAL select, orderby

[web2py] Re: orderby='' on Google App Engine

2010-12-06 Thread mdipierro
import random ... rows=db(...).select().sort(lambda row: random.random()) On Dec 6, 4:09 pm, Albert Abril wrote: > Hi! > > As said on the book, in a DAL select, orderby='' is not supported on > GAE.http://web2py.com/book/default/chapter/06#orderby,-groupby,-limitby,-... > > Someone knows the best