English 中文(简体)
3. 与谷歌应用引擎和大口径的回收关系
原标题:
  • 时间:2009-06-02 05:38:04
  •  标签:

在典型的关系数据库中,我有以下表格:

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))

我正试图将这一表格转换成谷歌搜索引擎。 我的问题涉及母亲和神父。 我尝试了以下法典,但没有机会。 灰 Python说,它不了解对象类型。

class Person(db.Model):
    mother = db.ReferenceProperty(Person)
    father = db.ReferenceProperty(Person)
    firstName = db.StringProperty()

难道有人知道,我们如何能够在谷歌应用引擎表格中形成一种恢复关系? 我怎么能够围绕应用引擎的限制开展工作?

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)

我对此进行了尝试,但却没有工作。 任何想法,我是错做的?

感谢!

最佳回答

我认为,你们在这里希望自我尊重。

class Person(db.Model):
    mother = db.SelfReferenceProperty(collection_name= mother_set )
    father = db.SelfReferenceProperty(collection_name= father_set )
    firstName = db.StringProperty()

或者,你可以把母亲和父亲的关系分开。

问题回答

暂无回答




相关问题
热门标签