limeuser / appengine-ndb-experiment

Automatically exported from code.google.com/p/appengine-ndb-experiment
Other
0 stars 0 forks source link

Projection validation doesn't apply to default_options (and hence not to GQL) #194

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
class Employee(ndb.Model):
  name = ndb.StringProperty()

<write some Employee instances>

Compare

Employee.query().fetch(projection=['qqq'])
# correctly raises BadProjectionError

to

Employee.query(default_options=ndb.QueryOptions(projection=['qqq']).fetch()
# returns []; should raise BadProjectionError

The second should also raise an exception.  Ideally it should fail when the 
query is constructed but if that's too hard it's okay to do it at run time.

Note that this affects GQL:

ndb.gql('SELECT qqq FROM Employee').fetch()
# returns [] instead of raising BadProjectionError

Original issue reported on code.google.com by gvanrossum@gmail.com on 2 Jul 2012 at 2:26

GoogleCodeExporter commented 9 years ago
Review here: http://codereview.appspot.com/6352065

(The tests just go through GQL.)

Original comment by gvanrossum@gmail.com on 2 Jul 2012 at 5:13

GoogleCodeExporter commented 9 years ago
I will soon merge this into the default branch. This will be released with SDK 
1.7.1.

Original comment by guido@google.com on 9 Jul 2012 at 7:59