Hi Massimo and howesc!

Testing again... I found a problem:

Do not return errors ( but returns no rows... ).
        rows = self.db(self.tabela.nome == nome).select(self.tabela.valor, 
self.tabela.valor_blob)
        
Returns the desired rows...
        rows = self.db(self.tabela.nome == nome).select()






On Monday, June 11, 2012 10:10:18 PM UTC-3, Alex Benfica wrote:
>
> Hello people!
>
> First of all... thank you Massimo and howesc!
>
> About this question that I did and Massimo and howesc answerd on Stack 
> Overflow.
> I tried to put some code there... but I could't...
>
>
> http://stackoverflow.com/questions/10940995/does-google-app-engine-projection-queries-are-supported-by-web2py
>
> I did the web2py update to trunk and some parts of my code stopped working.
> Most of problems I got where like this below, that I still don't know how 
> to solve and keep it efficient, as I need to find the values by "name", not 
> by id.
>
> I order to make it work, I just removed the fields I specified.
>
> Was this way (causing errors)
> self.db(self.tabela.nome == nome).select(self.tabela.valor, 
> self.tabela.valor_blob, self.tabela.nome)
>
> I did that... now it selects all fields again... but works!
> self.db(self.tabela.nome == nome).select()
>
> I'm problably missing something! How can I use projection queries with 
> web2py? The ID field that web2py creates are the same ID used by datastore 
> on GAE?
> I have a product that I need find by name... can I query it using 
> projection queries? Is that?
>
>
>
>
> rows = self.db(self.tabela.nome == nome).select(self.tabela.valor, 
> self.tabela.valor_blob, self.tabela.nome)
>   File "D:\Dropbox\Devel\www\web2py\gluon\dal.py", line 8161, in select
>     return adapter.select(self.query,fields,attributes)
>   File "D:\Dropbox\Devel\www\web2py\gluon\dal.py", line 4149, in select
>     for t in fields] for item in items]
>   File "C:\Program Files 
> (x86)\Google\google_appengine\google\appengine\ext\db\__init__.py", line 
> 2313, in next
>     return self.__model_class.from_entity(self.__iterator.next())
>   File "C:\Program Files 
> (x86)\Google\google_appengine\google\appengine\datastore\datastore_query.py", 
> line 2809, in next
>     next_batch = self.__batcher.next()
>   File "C:\Program Files 
> (x86)\Google\google_appengine\google\appengine\datastore\datastore_query.py", 
> line 2671, in next
>     return self.next_batch(self.AT_LEAST_ONE)
>   File "C:\Program Files 
> (x86)\Google\google_appengine\google\appengine\datastore\datastore_query.py", 
> line 2708, in next_batch
>     batch = self.__next_batch.get_result()
>   File "C:\Program Files 
> (x86)\Google\google_appengine\google\appengine\api\apiproxy_stub_map.py", 
> line 604, in get_result
>     return self.__get_result_hook(self)
>   File "C:\Program Files 
> (x86)\Google\google_appengine\google\appengine\datastore\datastore_query.py", 
> line 2450, in __query_result_hook
>     self._batch_shared.conn.check_rpc_success(rpc)
>   File "C:\Program Files 
> (x86)\Google\google_appengine\google\appengine\datastore\datastore_rpc.py", 
> line 1214, in check_rpc_success
>     raise _ToDatastoreError(err)
> BadRequestError: cannot use projection on a property with an equality 
> filter
>

Reply via email to