モデリングに関する Google ドキュメントをいくつか読みました (ところで、私は Python と GAE/webapp2 の初心者です)。リレーションシップでこれを行う方がはるかに簡単ですが、データストアやndbを使用してGoogleアプリエンジンを学ぼうとしています.
やろうとしている:私はいくつかのゾーンを持つ家を持っています。各ゾーンには、読み取り値を取得してサーバーに送信するセンサー(光、湿気、tmp)のグループがあります。
このようなもの:
Class User(db.Model):
user = db.UserProperty()
usertype = db.StringProperty()(aka mom/father/child)
class Home(db.Model):
zone = db.IntegerProperty() #Zones in home unique int
zonename = db.StringProperty() # optional name for the zone
class Zone(db. Model):
sensortype = db. key or name? # I'd like to model moisture/tmp/light sensors that will be hereSensors in zone (from class sensors ?)
SensorID = #Ideally a key for that sensor in the zone ?
DateCreated = db.DateProperty()
class Sensors(db.Model): # this will get the actual readings when they come in
Sensortype (moisture, tmp, light)
timeReading = db.DateProperty()
Reading = db.FloatProperty()
後で、すべての温度測定値 (すべてのゾーンまたは個々のゾーンから)、多くのセンサー、または個々のセンサーを読み取りたいと思うでしょう。日付/時間で並べ替えることができます。これらの測定値を天気予報とも比較します。
構造化されたオブジェクト、親/祖先を持つキー、または ReferenceProperty を使用する必要があるかどうかを判断するのに苦労しています。
どこから始めれば?私はこれをモデル化するのに最適な方法について途方に暮れています。
すべての助けを前もって感謝します。