GAE modeling relationship options
- by Sway
Hi there,
I need to model the following situation and I can't seem to find a
consistent example on how to do it "correctly" for the google app
engine.
Suppose I've got a simple situation like the following:
[Company] 1 ----- M [Stare]
A company has one to many stores. Each store has an address made up of
a address line 1, city, state, country, postcode etc.
Ok. Lets say we need to create say an "Audit". An Audit is for a
company and can be across one to many stares.
So something like:
[Audit] 1 ------ 1 [Company]
1 ------ M [Store]
Now we need to query all of the "audits" based on the Store
"addresses" in order to send the "Auditors" to the right locations.
There seem to be numerous articles like this one:
http://code.google.com/appengine/articles/modeling.html
Which give examples of creating a "ContactCompany" model class.
However they also say that you should use this kind of relationship
only when you "really need to" and with "care" for performance.
I've also read - frequently - that you should denormalize as much as
possible thereby moving all of the "query-able" data into the Audit
class.
So what would you suggest as the best way to solve this?
I've seen that there is an Expando class but I'm not sure if that is
the "best" option for this.
Any help or thoughts on this would be totally appreciated.
Thanks in advance,
Matt