Open GoogleCodeExporter opened 9 years ago
I have some more information on this issue, which may be illuminating.
I can reproduce this issue with:
models = Model.query().iter(
projection=[Model.name, Model.hash]
)
# or
models = Model.query().iter()
# or
models = Model.query()
In other words, the issue does not seem to be specific to projections or
asynchronous behaviour.
It may be that the problem is one of consistency in the HRD.
Perhaps I could test this if there were a way to modify the consistency policy
(--datastore_consistency_policy) in Testbed unit tests?
It isn't clear how to pass a consistency option (eg
`TimeBasedHRConsistencyPolicy` or `PseudoRandomHRConsistencyPolicy` from
`google.appengine.datastore.datastore_stub_util`) to Testbed's
`init_datastore_v3_stub()`. A little assistance would be greatly appreciated!
I will continue to muck around and see if I can determine the underlying
problem.
Original comment by brianmh...@gmail.com
on 27 Feb 2013 at 5:35
I also had an issue with NDB projections, but it was while running the
dev_appserver (did not try with testteb).
A simple query:
User.query(User.login >= req).fetch(5, projection=[User.login])
correctly found the users but their "login" property was None.
Original comment by ale...@freshplanet.com
on 27 Mar 2013 at 4:06
I eventually made a fairly elaborate set of test cases and concluded that the
issue that was exhibiting came was derived from the consistency policy (which
is an excellent endorsement of the choice to have the consistency policy follow
that at deployment).
The dev appserver was working as designed, though it would still be good to be
able to programatically change the consistency policy when unit testsing.
Original comment by brianmh...@gmail.com
on 27 Mar 2013 at 4:18
Since it has been distilled down to a problem with consistency, the title of
this issue might better read "add the option to change the db consistency
policy in unit tests"
Original comment by brianmh...@gmail.com
on 9 Apr 2013 at 2:04
class Model(ndb.Model): name = ndb.StringProperty(indexed=True) hash = ndb.StringProperty(indexed=True)
elsewhere ... populate Model
COUNT=500
future_kods = Model.query().fetch_async(COUNT, projection=[Model.name, Model.hash] )
models = future_kods.get_result()
for model in models: print "name: % hash: %s" % (name, hash)
Original issue reported on code.google.com by
brianmh...@gmail.com
on 25 Feb 2013 at 8:10