似乎 db.Key 和 ndb.Key 实例不一样。
我有一个 db.Key 实例。如何将其转换为 ndb.Key?
这就是我想要做的:
NDBEntity(ndb.Model):
some_property = ndb.StringProperty()
DBEntity(db.Model):
some_property = ndb.StringProperty()
# I have an instance of a DBEntity already saved in the datastore
db_entity_instance = DBEntity.all().get()
ndb_entity_instance = NDBEntity(id="some_id", parent=db_entity_instance.key(), some_property="foo").put()
# The above line doesn't work because it expects a Key Instance for the parent, and it doesn't seem to recognize a db.Key instance.
有任何想法吗?