ThePiachu ThePiachu - 1 month ago 4x
Java Question

What is Google App Engine's Datastore "parent key"?

What is the "parent key" used in Google App Engine's Datastore classes and what is it used for?


Reading over this would probably help you.

From the documentation:

To designate an entity's parent, use the parent argument to the model class constructor when creating the child entity. The value of this argument can be the parent entity itself or its key; you can get the key by calling the parent entity's key() method. The following example creates an entity of kind Address and shows two ways of designating an Employee entity as its parent:

#Create Employee entity
employee = Employee()

#Set Employee as Address entity 's parent directly...
address = Address(parent=employee)

# ...or using its key
e_key = employee.key()
address = Address(parent=e_key)

# Save Address entity to datastore