Yep, that fixes it! Thanks for your work on that!

On Tuesday, August 14, 2012 6:18:29 PM UTC-4, howesc wrote:
>
> i added a patch against trunk to the ticket.  spiffytech - can you see if 
> that works for you?
>
> cfh
>
> On Monday, August 13, 2012 12:20:02 AM UTC-7, howesc wrote:
>>
>> we do special query handling on the key field, so i suspect the multiple 
>> filters on key is wonky.  i'll try and look at this in the next couple of 
>> days....
>>
>> thanks for reporting, and thanks for your patience guiding us through it. 
>> :)
>>
>> christian
>>
>> On Sunday, August 12, 2012 8:01:29 PM UTC-7, spiffytech wrote:
>>>
>>> Yes, I've verified that this can be done. The below query works in the 
>>> App Engine Datastore Viewer (note that it only worked once I manually 
>>> created the index in index.yaml and deployed it; web2py did not 
>>> automatically create the appropriate index:
>>>
>>> SELECT * FROM posts WHERE __key__ IN (KEY('posts', 3), KEY('posts', 4), 
>>> KEY('posts', 1003)) and post_date <= DATETIME('2012-08-12 00:00:00') ORDER 
>>> BY post_date DESC
>>>
>>>
>>> On Sunday, August 12, 2012 9:56:20 PM UTC-4, Anthony wrote:
>>>>
>>>> How would you do the query in GQL? Have you confirmed that it can be 
>>>> done?
>>>>
>>>> Anthony
>>>>
>>>> On Sunday, August 12, 2012 9:23:39 PM UTC-4, spiffytech wrote:
>>>>>
>>>>> I tested with your suggested orderby, but the outcome was the same.
>>>>>
>>>>> I tested with the query as you wrote it below, with no common_filter, 
>>>>> and the query still failed. Since that's a pretty straightforward query 
>>>>> that should work, this seems like a bug to me, so I filed a web2py bug 
>>>>> report: http://code.google.com/p/web2py/issues/detail?id=930
>>>>>
>>>>>
>>>>> On Thursday, August 9, 2012 5:39:14 PM UTC-4, howesc wrote:
>>>>>>
>>>>>> i had to look up common_filters.....based on your experience i would 
>>>>>> assume that this is being implemented as a query filter rather than 
>>>>>> getting 
>>>>>> results from the DB and then filtering them.  so what is must be causing 
>>>>>> in 
>>>>>> your case is:
>>>>>>
>>>>>> posts = db((db.posts.id.belongs(post_ids)) & 
>>>>>> (db.posts.post_date<=request.now)).select(db.posts.ALL,orderby=db.posts.post_date,
>>>>>>  cache
>>>>>> =(cache.ram, 60))
>>>>>>
>>>>>> it *might* work if you put an orderby on that is 
>>>>>> db.posts.id|db.posts.post_date  
>>>>>> i'm not sure.  you might have to remove the common filter for this query 
>>>>>> and then filter the results. (i don't have experience with common 
>>>>>> filters 
>>>>>> and how they are implemented)
>>>>>>
>>>>>> GAE has a restriction on IN queries (web2py belongs queries) that 
>>>>>> they have no more than 30 items in the list.  "because i said so" says 
>>>>>> google.
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Thursday, August 9, 2012 1:57:13 PM UTC-7, spiffytech wrote:
>>>>>>>
>>>>>>> I've narrowed the problem down further- the exception is caused by a 
>>>>>>> common_filter attached to my posts table:
>>>>>>>
>>>>>>> common_filter = lambda query: db.posts.post_date <= request.now
>>>>>>>
>>>>>>> I'm not sure why that would trigger the orderby error, though. 
>>>>>>>
>>>>>>> Also, is there some significance to limiting the belongs lists to 30 
>>>>>>> items?
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On Thursday, August 9, 2012 4:24:13 PM UTC-4, howesc wrote:
>>>>>>>>
>>>>>>>> the query and the error message do not match.  your query has no 
>>>>>>>> orderby, yet the error message suggests there is an orderby property 
>>>>>>>> set.  
>>>>>>>> this confuses me.
>>>>>>>>
>>>>>>>> i do:
>>>>>>>>
>>>>>>>> db(db.table.id.belongs([list of items not more than 30 
>>>>>>>> long])).select()
>>>>>>>>
>>>>>>>> all the time on GAE and it works for me (latest stable web2py, and 
>>>>>>>> the last time i checked trunk though that was a few weeks ago)
>>>>>>>>
>>>>>>>> note that cache does nothing on selects on GAE due to the inability 
>>>>>>>> to serialize Rows objects to memcache (at least i think that is the 
>>>>>>>> limitation)
>>>>>>>>
>>>>>>>> cfh
>>>>>>>>
>>>>>>>> On Thursday, August 9, 2012 10:40:33 AM UTC-7, spiffytech wrote:
>>>>>>>>>
>>>>>>>>> I'm trying to use the DAL belongs clause on App Engine and am 
>>>>>>>>> getting an error. 
>>>>>>>>>
>>>>>>>>> posts = db(db.posts.id.belongs(post_ids)).select(db.posts.ALL,cache
>>>>>>>>> =(cache.ram, 60))
>>>>>>>>>
>>>>>>>>> Produces:
>>>>>>>>>
>>>>>>>>> BadArgumentError: First ordering property must be the same as 
>>>>>>>>> inequality filter property, if specified for this query; received 
>>>>>>>>> __key__, 
>>>>>>>>> expected post_date
>>>>>>>>>
>>>>>>>>> Some Googling suggests this can be due to not providing a sort 
>>>>>>>>> key. I tried orderby=db.posts.post_date with no success. What 
>>>>>>>>> could be going wrong?
>>>>>>>>>
>>>>>>>>> I'm using the latest trunk web2py, but tested all the way back to 
>>>>>>>>> 1.99.3.
>>>>>>>>>
>>>>>>>>

-- 



Reply via email to