似乎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.
有什么想法吗?