我想从Google API v3将联系人保存在AppEngine 数据存储中。我想知道存储这些数据的最佳方式是什么,尤其是在已经有模型的情况下!
查看gdata 的来源,我发现了一个非常有趣的开始。但这只是python中的数据建模,而不是数据存储。
问题:这个模型是否已经存在于 python 中?
如果不:
问题:从头开始的最佳方法是什么?
Python中联系人的开始示例:
class Contact(db.Model):
"""
https://developers.google.com/gdata/docs/2.0/elements?hl=fr#gdContactKind
https://developers.google.com/appengine/docs/python/datastore/datamodeling
"""
content = db.Text()
"""atom:content Notes about the contact."""
link = db.ListProperty(Link,indexed=False,default=[])
"""atom:link* Links to related information. Specifically, atom:link[@rel='alternate'] links to an HTML page describing the contact."""
title = db.StringProperty()
"""atom:title Contact's name. This field is read only. To modify the contact's name, see gd:name."""
email = db.ListProperty(Email,indexed=False,default=[])
"""gd:email* Email addresses."""
"""etc..."""
class Link(db.Model):
"""
Link
"""
link = db.LinkProperty()
class Email(db.Model):
"""
Email
"""
email_address = db.EmailProperty()
class EmailImParent(db.Model):
address = db.StringProperty()
label = db.StringProperty()
rel = db.StringProperty()
primary = db.StringProperty()
class Email(db.Model,EmailImParent):
"""
The gd:email element.
"""
email = db.EmailProperty()
display_name = db.StringProperty()