[web2py] Re: GAE NDB is there a problem with using belongs on an id field?

2014-11-04 Thread Quint
There was something else I wanted to check. But I need the stack trace first. Could you post it? On Sunday, November 2, 2014 12:18:50 AM UTC+1, Russ King wrote: I have established at least a work-around to this issue by updating google.py file in adapters and creating a new class to use

[web2py] Re: GAE NDB is there a problem with using belongs on an id field?

2014-11-04 Thread Quint
I suspect we need to add something like this in google.py. But I cannot test anything at the moment so maybe you can try this? def filter(self, query, tableobj, prop, op, value): # NDB uses _key in stead of __key__ if prop == __key__: prop = _key return self.GAE_FILTER_OPTIONS[op](query,

[web2py] Re: GAE NDB is there a problem with using belongs on an id field?

2014-11-04 Thread Russ King
Hi Quint Below is the trace - hope it hepls. Russ Traceback (most recent call last): File C:\web2pysrcdev\web2py\gluon\restricted.py, line 224, in restricted exec ccode in environment File C:\web2pysrcdev\web2py\applications\gaetest\controllers/default.py, line 128, in module

[web2py] Re: GAE NDB is there a problem with using belongs on an id field?

2014-11-01 Thread Russ King
I have established at least a work-around to this issue by updating google.py file in adapters and creating a new class to use instead of GAEF when ndb is being used: class GAEFNDB(object): #This is a work around to belongs not working on id fields when using ndb def

Re: [web2py] Re: GAE NDB is there a problem with using belongs on an id field?

2014-09-02 Thread Quint
I will try to test this later but I can tell you now how IN relates to BELONGS. GAE does not have belongs and web2py solves this by using IN. Also you must realize that GAE performs a separate subquery for every item with a IN clause. So this is very inefficient. You're also limited to 30

[web2py] Re: GAE NDB is there a problem with using belongs on an id field?

2014-09-02 Thread Quint
Looking at the code again, I see there are 5 more instances of: Key.from_path I think they should all be replaced by: self.keyfunc (Not necessarily related to the issue btw) On Monday, September 1, 2014 1:32:33 PM UTC+2, Quint wrote: Ok, I did not test this but from what can see from here

[web2py] Re: GAE NDB is there a problem with using belongs on an id field?

2014-09-01 Thread dlypka
It looks like GAE has the 'Projection Query' feature to allow selecting a subset of columns / properties: https://developers.google.com/appengine/docs/python/datastore/projectionqueries On Friday, August 29, 2014 11:18:00 PM UTC-5, Massimo Di Pierro wrote: This should work, can you please open

[web2py] Re: GAE NDB is there a problem with using belongs on an id field?

2014-09-01 Thread Quint
Ok, I did not test this but from what can see from here the line below needs to be changed. (This line does not yet consider NDB.) def BELONGS(self, first, second=None): if not isinstance(second, (list, tuple, set)): raise SyntaxError(Not supported) if not self.use_ndb: if

Re: [web2py] Re: GAE NDB is there a problem with using belongs on an id field?

2014-09-01 Thread Russ King
Many thanks for reply however this doesn't seem to be a complete fix - code is failing on the 'in' piece of this filter function and I am not clear how this relates to the belongs code up above. Regards Russ GAE_FILTER_OPTIONS = { '=': lambda q, t, p, v: q.filter(getattr(t,p) ==

Re: [web2py] Re: GAE NDB is there a problem with using belongs on an id field?

2014-09-01 Thread Quint
Could you post the stacktrace? -- 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] Re: GAE NDB is there a problem with using belongs on an id field?

2014-08-29 Thread Massimo Di Pierro
This should work, can you please open a ticket? Mind that it is pointless to select columns/fields on GAE since it always fetches them all. On Friday, 29 August 2014 18:37:07 UTC-5, Russ King wrote: I am struggling to use belongs on GAE+NDB it appears that: quests =