NDB: request to cancel properties?

I had several data collected in production over several days, say, of the following model:

class Tags(ndb.Model):
    dt_added = ndb.DateTimeProperty(auto_now_add=True)
    s_name   = ndb.StringProperty(required=True, indexed=True)

Imagine now that I am adding a new model property:

class Foo(ndb.Model):
    is_valid = ndb.BooleanProperty(default=False)
    some_key = ndb.KeyProperty(repeated=True)

class Tags(ndb.Model):
    dt_added = ndb.DateTimeProperty(auto_now_add=True)
    name     = ndb.StringProperty(required=True, indexed=True)
    new_prop = ndb.StructuredProperty(Foo)

... and collect some more data with this new model.

So now I have a piece of data that has a property new_prop, and another piece that does not have it.

My question is: how do I request data with a new property new_propNOT set?

I tried:

query_tags = Tags.query(Tags.new_prop == None).fetch()

But it looks like data cannot be obtained without this set of properties ... Any suggestions? Thank!

+4
source share
1 answer

Datastore , , , (None).

, . - () None, None .

+5

Source: https://habr.com/ru/post/1547639/


All Articles