Massimo, Sorry for the delayed response.... took me a while to get trunk, unzip correctly, etc.... although I know now.
I used the trunk version. If I put in: http://localhost:8080/hosp/api/calldatasmart.json?search=call.start is greater than "2010-03-14" I still get the same error... If I put in: http://localhost:8080/hosp/api/calldatasmart.json?search=call.start is greater than "2010-03-14 20:58:54" IT WORKS PERFECTLY. I expect that this is an error from your perspective in the trunk still, however I am happy to put in the full date and time, and get it to work, so thanks very much. Doug On Tuesday, 10 April 2012 00:21:51 UTC+10, Massimo Di Pierro wrote: > > This is actually not a GAE issue. This is a smartgrid issue. Because you > are comparing with a datetime issue, it expects the time as part of the > date. I just change the parsing routine in trunk to fix this problem. Give > it a try. > > Massimo > > On Sunday, 8 April 2012 22:36:34 UTC-5, Douglas Ross wrote: >> >> Hi, >> >> I know the documentation explains that you cannot do 'complex' datetime >> queries in web2py with GAE, however I am hoping that this does not qualify >> as 'complex'. >> >> I am trying to use the smartquery (experimental) functionality that it >> works really well in the SQLlite db. >> >> Unfortunately, the same call fails in GAE. >> >> I am using Version 1.99.7, and the latest GAE. >> >> To reproduce the problem, I have a table with a datetime field: >> >> db.define_table('call', >> Field('start', 'datetime'), >> Field('end', 'datetime'), >> Field('created_on','datetime',default=request.now, >> label=T('Created On'),writable=False,readable=False), >> Field('modified_on','datetime',default=request.now, >> label=T('Modified On'),writable=False,readable=False, >> update=request.now)) >> >> I have created an REST interface using the smartquery functionality, that >> works well on SQL lite: >> >> @request.restful() >> #@auth.requires_login() >> def calldatasmart(): >> response.view = 'generic.'+request.extension >> def GET(search): >> try: >> rows = db.smart_query([db.call],search).select() >> return dict(result=rows) >> except RuntimeError: >> raise HTTP(400,"Invalid search string") >> return locals() >> >> Now if I do the following I get the correct response from SQLLite and an >> error from GAE. (Note: I created the data using the default=request.now >> function, so it should be a datetime in the datastore. >> >> http://localhost:8080/api/calldatasmart.json?search=call.created_on is >> greater than "2012-03-20" >> >> Error in GAE: >> >> File "/........./gluon/dal.py", line 3396, in represent >> >> time_items = map(int,str(obj)[11:].strip().split(':')[:3]) >> >> ValueError: invalid literal for int() with base 10: '' >> Question: >> 1. Is this a bug in the experimental smartquery functionality? >> 2. Does all datetime comparisons not work with GAE? >> 3. Can I use a GQL call to do it, or is there a way in Web2py to do it >> nicely? >> >> BTW: I have not coded as much as this for 15 years, and I have not had so >> much fun in getting back into it. So thankyou all for the work you have >> done to create web2py... >> >> Doug >> >>

