In the GAE I'm trying to find a way to implement or construct something similar to a foreign key constraint in a SQL database. Basically, deleting an entity that is being refered by another entity via a foreign key constraint should not be allowed (in other words: deleting a parent should not be allowed if there are children that refer to that parent).
I tried the KeyProperty
in the ndb datastore but that gives me no options to find all depenend entites from the entity I want to delete. Also the ancestor
hierarchy doesn't seem to cut it. I can query the ancestor
from the children, but there doesn't seem a way to query the children from the ancestor
.
Is there any way to either get the children from an ancestor
or another database design in the GAE ndb datastore to implement this foreign key constraint?