DAOCLOUD
推荐学习书目
Python Cookbook
Using Google App Engine
推荐下载
Latest Google App Engine SDK
其他兼容技术
AppScale
wickila

关于GAE的数据存储

  •  
  •   wickila · Apr 14, 2011 · 5679 views
    This topic created in 5533 days ago, the information mentioned may be changed or developed.
    from google.appengine.ext import db

    class Pet(db.Model):
    name = db.StringProperty(required=True)
    type = db.StringProperty(required=True, choices=set(["cat", "dog", "bird"]))
    birthdate = db.DateProperty()
    weight_in_pounds = db.IntegerProperty()
    spayed_or_neutered = db.BooleanProperty()
    owner = db.UserProperty(required=True)

    本人是GAE的新手,关于GAE的开发文档中的这段代码有些问题,想麻烦大家帮忙解答一下
    1,这段代码是不是会创建一个叫pet的一个数据的table,如果是的话,我以后想要给pet加一个属性的时候该怎么办?
    2,这段代码如果运行在本地的开发测试中,创建的数据会存储在那里?
    2 replies    1970-01-01 08:00:00 +08:00
    lepture
        1
    lepture  
       Apr 14, 2011
    GAE db 不是普通的数据库。

    1. 直接加上属性就可以了。 之前的数据没有新增的属性。 新增的数据会有该属性。

    2. 默认情况下会创建在一个tmp里。。 linux是在 /tmp 里,windows没用过,不知道。 你可以指定位置。
    wickila
        2
    wickila  
    OP
       Apr 15, 2011
    @lepture 差不多了解了。多谢
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2936 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 37ms · UTC 07:27 · PVG 15:27 · LAX 00:27 · JFK 03:27
    ♥ Do have faith in what you're doing.