I'm trying to execute the following query:
query = Comment.query(ancestor = userKey, ndb.OR(Comment.modifiedDate > lastSyncDate, Comment.activityDate > lastSyncDate))
The 1 equal sign (=) is how the docs said we should have it, but my app doesn't run when I have just 1 equal sign (build error). If I use two equal sign, like ancestor == userKey
, then the app runs, but I get a NameError: global name 'ancestor' is not defined
. What gives?
I also tried another variant of this query, but the same exact problem occurs:
query = Comment.query(ndb.AND(ancestor == userKey, ndb.OR(Comment.modifiedDate > lastSyncDate, Comment.activityDate > lastSyncDate)))
You need to put the
ancestor
keyword after the method positional parameters:Alternatively, use the
filters
keyword explicitly, or use the.filter()
method:or