Can you please open a pydal issue about this?

On Friday, 21 August 2015 18:44:02 UTC-5, Jaime Sempere wrote:
>
> Hi,
>
>
> Im using web2py 2.9.12, Im developing on local gae, and when I tried to 
> execute this query:
>
>     pics = db(db.pics.user_id==user_id).select(db.pics.img_link, 
> projection=True 
>    ,orderby=~db.pics.up_date, limitby=(num_min, num_max))
>
>
> I got that error 
>
>  WARNING  2015-08-21 23:40:54,728 tasklets.py:410] suspended generator 
> run_to_queue(query.py:938) raised BadRequestError(projection and keys_only 
> cannot both be set)
> WARNING  2015-08-21 23:40:54,729 tasklets.py:410] suspended generator 
> helper(context.py:876) raised BadRequestError(projection and keys_only 
> cannot both be set)
> WARNING  2015-08-21 23:40:54,729 tasklets.py:410] suspended generator 
> has_next_async(query.py:1760) raised BadRequestError(projection and 
> keys_only cannot both be set)
> WARNING  2015-08-21 23:40:54,730 tasklets.py:410] suspended generator 
> _fetch_page_async(query.py:1349) raised BadRequestError(projection and 
> keys_only cannot both be set)
> ERROR    2015-08-21 23:40:54,736 restricted.py:69]  Unable to store in 
> FILE: 
> /home/jukvoxman/uweb2py2.9.12/applications/relatos/controllers/default.py
>
> Traceback (most recent call last):
>   File "/home/jukvoxman/uweb2py2.9.12/gluon/restricted.py", line 227, in 
> restricted
>     exec ccode in environment
>   File 
> "/home/jukvoxman/uweb2py2.9.12/applications/relatos/controllers/default.py", 
> line 224, in <module>
>   File "/home/jukvoxman/uweb2py2.9.12/gluon/globals.py", line 412, in 
> <lambda>
>     self._caller = lambda f: f()
>   File 
> "/home/jukvoxman/uweb2py2.9.12/applications/relatos/controllers/default.py", 
> line 82, in getPicsRangeByUserId
>     projection=True    ,orderby=~db.pics.up_date, limitby=(num_min, 
> num_max))
>   File 
> "/home/jukvoxman/uweb2py2.9.12/gluon/packages/dal/pydal/objects.py", line 
> 2026, in select
>     return adapter.select(self.query,fields,attributes)
>   File 
> "/home/jukvoxman/uweb2py2.9.12/gluon/packages/dal/pydal/adapters/google_adapters.py",
>  
> line 484, in select
>     (items, tablename, fields) = self.select_raw(query,fields,attributes)
>   File 
> "/home/jukvoxman/uweb2py2.9.12/gluon/packages/dal/pydal/adapters/google_adapters.py",
>  
> line 449, in select_raw
>     keys, cursor, more = items.fetch_page(limit,**fetch_args)
>   File 
> "/home/jukvoxman/google_appengine/google/appengine/ext/ndb/utils.py", line 
> 142, in positional_wrapper
>     return wrapped(*args, **kwds)
>   File 
> "/home/jukvoxman/google_appengine/google/appengine/ext/ndb/query.py", line 
> 1331, in fetch_page
>     return self.fetch_page_async(page_size, **q_options).get_result()
>   File 
> "/home/jukvoxman/google_appengine/google/appengine/ext/ndb/tasklets.py", 
> line 326, in get_result
>     self.check_success()
>   File 
> "/home/jukvoxman/google_appengine/google/appengine/ext/ndb/tasklets.py", 
> line 369, in _help_tasklet_along
>     value = gen.throw(exc.__class__, exc, tb)
>   File 
> "/home/jukvoxman/google_appengine/google/appengine/ext/ndb/query.py", line 
> 1349, in _fetch_page_async
>     while (yield it.has_next_async()):
>   File 
> "/home/jukvoxman/google_appengine/google/appengine/ext/ndb/tasklets.py", 
> line 369, in _help_tasklet_along
>     value = gen.throw(exc.__class__, exc, tb)
>   File 
> "/home/jukvoxman/google_appengine/google/appengine/ext/ndb/query.py", line 
> 1760, in has_next_async
>     yield self._fut
>   File 
> "/home/jukvoxman/google_appengine/google/appengine/ext/ndb/context.py", 
> line 876, in helper
>     batch, i, ent = yield inq.getq()
>   File 
> "/home/jukvoxman/google_appengine/google/appengine/ext/ndb/query.py", line 
> 938, in run_to_queue
>     batch = yield rpc
>   File 
> "/home/jukvoxman/google_appengine/google/appengine/ext/ndb/tasklets.py", 
> line 455, in _on_rpc_completion
>     result = rpc.get_result()
>   File 
> "/home/jukvoxman/google_appengine/google/appengine/api/apiproxy_stub_map.py", 
> line 613, in get_result
>     return self.__get_result_hook(self)
>   File 
> "/home/jukvoxman/google_appengine/google/appengine/datastore/datastore_query.py",
>  
> line 2897, in __query_result_hook
>     self._batch_shared.conn.check_rpc_success(rpc)
>   File 
> "/home/jukvoxman/google_appengine/google/appengine/datastore/datastore_rpc.py",
>  
> line 1373, in check_rpc_success
>     raise _ToDatastoreError(err)
> BadRequestError: projection and keys_only cannot both be set
>
>
>
>
> I have set and index on img_link row (pics entity) like this to be able to 
> make the projection query on this row:
>
> - kind: pics
>   properties:
>   - name: user_id
>   - name: img_link
>   - name: up_date
>     direction: desc
>
>
> But still no luck... is this a bug or could someone give me a workaround 
> to fix it?
>
> Thanks in advance!
>

-- 
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