Hello all,
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 into a Google App Engine table. My issue is with the fields MotherId and FatherId. I tried the code below, but no chance. Python says that it doesn't know the object type Person.
class Person(db.Model):
mother = db.ReferenceProperty(Person)
father = db.ReferenceProperty(Person)
firstName = db.StringProperty()
Does someone know how we can model a recursive relationship in a Google App Engine table? How could I work around the limitation of App Engine?
UPDATE I want to expand the problem a little 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 doesn't work. Any idea what I am doing wrong?
Thanks!