【问题标题】:Populating data in appengine database from a csv file or spreadsheet from google docs从 csv 文件或来自 google docs 的电子表格填充 appengine 数据库中的数据
【发布时间】:2012-04-06 05:50:16
【问题描述】:

我在谷歌应用引擎上使用 webapp2 我的数据库模型具有以下架构:

class Match(db.Model):
    start_date = db.DateProperty()
    start_time = db.TimeProperty()
    team1 = db.StringProperty()
    team2 = db.StringProperty()
    venue = db.StringProperty()
    result = db.IntegerProperty()

我有一个 csv 文件或者说 google 电子表格,所有数据大约有 150 行。

手动输入所有值是一件很痛苦的事情。谁能建议我如何更新数据库?

【问题讨论】:

    标签: python database google-app-engine google-docs google-docs-api


    【解决方案1】:

    您可以创建一个页面,您可以将 CSV 文件的内容发布到该页面,然后使用 Python csv 模块读取文件并遍历行,同时插入模型实例。

    【讨论】:

    • 我隐约明白你的意思。能否请您详细说明一下,从我的评分中可以看出,我有点新。
    • 我建议阅读 AppEngine 文档,了解如何处理请求和读取 POST 数据。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-03-21
    • 1970-01-01
    • 2011-02-22
    • 2017-04-17
    • 1970-01-01
    相关资源
    最近更新 更多