google app engine - Non-root entity group queries returning zero results -
i porting app google app engine appscale, , have discovered peculiar behaviour when performing ancestor queries on entity groups.
if perform ancestor query parent not root, query returns 0 results. if perform same query parent root, right results returned.
easiest illustrate example:
class a(ndb.model): name = ndb.stringproperty() class b(ndb.model): name = ndb.stringproperty() class c(ndb.model): name = ndb.stringproperty() active = ndb.booleanproperty() sort = ndb.integerproperty() def main(): = a(name='i a') a.put() b = b(parent=a.key, name='i b') b.put() c(parent=b.key, name='i c1', active=true, sort=0).put() c(parent=b.key, name='i c2', active=true, sort=1).put() c(parent=b.key, name='i c3', active=true, sort=2).put() query1 = c.query(c.active == true, ancestor=a.key).order(c.sort).fetch(10) query2 = c.query(c.active == true, ancestor=b.key).order(c.sort).fetch(10) print 'query 1 = %s' % len(query1) print 'query 2 = %s' % len(query2)
if run above code on app engine 3 results both queries. if run on appscale, 3 results first query, , 0 results sec query.
appscale uses cassandra datastore. subtle difference in behaviour between app engine datastore , cassandra?
this bug in appscale used total path of provided ancestor , not root entity composite queries. prepare can found here: https://github.com/appscale/appscale/pull/1633
google-app-engine cassandra nosql datastore appscale
No comments:
Post a Comment