You might also want to read:
http://code.google.com/appengine/articles/modeling.html

It discusses ways to model different types of relationships as well.

Robert






On Wed, Mar 24, 2010 at 8:11 PM, Tim Hoffman <[email protected]> wrote:
> Hi
>
> You really should start by thinking about the realized entities and
> how they relate to each other at a
> an application level rather than a sql table layout.  Even think of it
> as a high level Entity model in UML
> before its transformed into a datamodel.  Thats probably a closer
> representation of how you will do it in app engine.
>
> For instance (this is pseudo code ;-) so bits are missing and the not
> valid syntax but you should get the idea.
>
> class Customer:
>      name = stringproperty
>      address= stringproperty
>
> class Premise:
>      ownedBy = referenceproperty(Customer)
>      address = stringproperty
>
> class Person:
>      worksFor = referenceproperty(Customer):
>      locatedAt = referenceproperty(Premise)
>
> So you would then do something like
>
> c1 = Company()
> c1.name = "company1"
> c1.address = "1 somwhere road"
> c1.put()
>
> a1 = Premise()
> a1.ownedBy = c1
> a1.address = "2 somwhere else"
> a1.put()
>
> p1 = Person()
> p1.worksFor = c1
> p1.residesAt = a1
> p1.put()
>
> Have a read up on References that will help a lot
>
> This looks a but like python which gives a good match between an
> simple object model and how its implemented as datastore entities.
> There are other ways of defining what you want especially in java that
> look more table oriented, but you should try thinking about your data
> as object graphs.
>
> Hope this helps
>
> T
>
>
> On Mar 24, 7:08 am, RonBurgundy <[email protected]> wrote:
>> Hi,
>>
>> I am having real problems trying to understand the architecture of
>> google app engine database as I am coming from  SQL / Access database
>> design. I have read all of your online documentation and watched
>> various videos on you tube but still not sure how to design it.
>>
>> I am trying to replicate a simple db that I use onto google app
>> engine:
>>
>> tblCustomer
>> tblPremise
>> tblPerson
>>
>> tblCustomer is the main table and will have details like company name
>> and company address
>> tblPremise links to the customer table such that 1 customer could have
>> a number of premises, the premise table would hold info like address
>> tblPerson links to both customer and premise such that all of the
>> people are stored under customer but could be 1-1 relationship for
>> premise
>>
>> Would it be possible to provide me with an understanding of how I
>> would structure the db and link it together in the code please?
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Google App Engine" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/google-appengine?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to