From one to many relationships in a data warehouse and replication in a google application?

I have a one-to-many relationship between two objects, the first of which is a satellite and the second a channel, and the satellite form returns the name of the satellite, which I want to display on another html page with channel data, where you can say that this channel connected with this satellite how to do it

+4
source share
1 answer

This sounds good for using ReferenceProperty, which is part of the Datastore API for App Engine. Here is an idea to get you started:

class Satellite(db.Model): name = db.StringProperty() class Channel(db.Model): satellite = db.ReferenceProperty(Satellite, collection_name='channels') freq = db.StringProperty() 

With this, you can assign these channels:

 my_sat = Satellite(name='SatCOM1') my_sat.put() Channel(satellite=my_sat,freq='28.1200Hz').put() ... #Add other channels ... 

Then skip the channels for this Satellite object:

 for chan in my_sat.channels: print 'Channel frequency: %s' % (chan.freq) 

In any case, this largely follows in this article , which describes how to model entity relationships in App Engine. Hope this helps.

+6
source

All Articles