I want to understand the parent/child (ancestor paths) relationship found in the Google AppEngine datastore that wasn't mentioned in the online documentation. What happens to children objects when the parent is deleted? Do child objects also get deleted? Do they become orphaned without a parent? If so how would you query for them?
Google Help Doc regarding Ancestor Paths: https://cloud.google.com/appengine/docs/go/datastore/entities#Go_Ancestor_paths
Thanks! ~Todd
Child entities do not get deleted when the ancestor is deleted: there's no 'cascade on delete' behaviour. In fact, an ancestor entity doesn't even have to exist when defining an entity group (only its Key).
They will remain unaffected, you will just be unable to get their parent entity. i.e.
child_entity.key.parent().get()
will return None.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With