In a classic relational database, I have the following table:
CREATE TABLE Person(
Id int IDENTITY(1,1) NOT NULL PRIMARY KEY,
MotherId int NOT NULL REFERENCES Person(Id),
FatherId int NOT NULL REFERENCES Person(Id),
FirstName nvarchar(255))
I am trying to convert this table to a Google App Engine table. My problem is with the fields MotherId and FatherId. I tried the code below, but no chance. Python says that it does not know the type of the Person object.
class Person(db.Model):
mother = db.ReferenceProperty(Person)
father = db.ReferenceProperty(Person)
firstName = db.StringProperty()
Does anyone know how we can model recursive relationships in a Google App Engine spreadsheet? How can I get around App Engine restrictions?
UPDATE
I want to expand the problem a bit ... What if I wanted to add a collection of children?
children = db.SelfReferenceProperty(collection_name='children_set')
dad.children.append(childrenOne)
I tried this and it does not work. Any idea what I'm doing wrong?
Thanks!