I would like to confirm my understanding of the possible consistency in the Google data warehouse. Suppose I have an entity defined as follows (using ndb):
class Record(ndb.Model): name = ndb.StringProperty() content = ndb.BlobProperty()
I think I understand Scenarios 1, but I have doubts about Scenarios 2 and 3, so some tips would be much appreciated.
Scenario 1: I insert a new record with the name "Luca" and the specified content. Then I query the data store:
qry = Record.query(name=="Luca") for r in qry.iter(): logger.info("I got this content: %r" % r.content)
I understand that because of possible consistency, the record just inserted cannot be part of the result set. I know about using ancestral queries to do this if necessary.
Scenario 2: I read an existing entry called "Luca", updated the contents, and wrote it down. For example, if I have the key "k" for this entry:
r = k.get() r.content = "new content" r.put()
Then I run the same query as in scenario 1. When I get the results, suppose the record is part of the result set (for example, since the index already contains the record named "Luca" and the key k). I then guaranteed that in the field content there will be a new meaning "new content"? In other words, if I update the record, leaving only my key and indexed fields, I'm sure I will read the last value?
Scenario 3: I do the same as scenario 2, again, where k is the record key named "Luca":
r = k.get() r.content = "new content" r.put()
but then I run a modified version of the request:
qry = Record.query(name=="Luca") for k in qry.iter(keys_only=True): r = k.get() logger.info("I got this content: %r" % r.content)
In this case, the logic tells me that I should get the last value of the content, because reading by keywords guarantees high consistency. I would appreciate confirmation.