This is correct. I think Jimin maybe doesn't realize that the parent key is *appended* to the child's, so it is a 1:N relationship, not a 1:1 relationship?
Jimin, what language are you using? If you're using Java, then Objectify can make this much simpler, as you just decorate a [Customer] field in the [Purchase] object with the @Parent annotation and Objectify will handle the rest for you. On Monday, December 2, 2013 5:25:15 AM UTC-6, Klaus Post wrote: > > Hi! > > (Since nobody wrote back, I thought I'd give it a shot even though I am > also beginner) > > It seems like you are on the right track. It might be simpler than you > think. > > I would also make Purchases a child of the Customer, so you can do a > simple search by simply querying "where ancestor=customer_key". So any > purchase creates a "Purchase" entity as you describe. This will also make > all purchases of a single customer consistent, and you can do transactions, > and still have a scalable system. In some cases you could also stick some > extra information about the customer into the "purchase" without indexes - > but in general that shouldn't be needed. > > The biggest challenge will probably be inventory management, but depending > on your business needs you can probably also aplit that into entity groups > of a managable size,so you don't have a single entity group for your > inventory items. > > Have fun :) > > > Regards, Klaus > > On Friday, November 29, 2013 10:50:52 PM UTC+1, Jimin Park wrote: >> >> I am a beginner to DataStore and I am wondering how I should use it to >> achieve what I want to do. >> >> For example, my app needs to keep track of customers and all their >> purchases. >> >> Coming from relational database, I can achieve this by creating >> [Customers] and [Purchases] table. >> In DataStore, I can make [Customers] and [Purchases] kinds. >> >> Where I am struggling is the structure of the [Purchases] kind. >> >> If I make [Purchases] as the child of [Customers] kind, would there be >> one entity in [Customers] and one entity in [Purchases] that share the same >> key? Does this mean in side of this [Purchases] entity, I would have a >> property that just keeps increasing for each purchase they make? >> >> Or would I have one [Purchases] entity for each purchase they make and in >> each of these entities I would have a property that points to a entity in >> [Customers] kind? >> >> How does DataStore perform in these scenarios? >> > -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/google-appengine. For more options, visit https://groups.google.com/groups/opt_out.
