What you're describing is the JDO layer that's implemented on top of the GAE datastore low-level API; the JDO layer has the concept of relationships, the GAE low-level API doesn't. It looks like the JDO layer implements relationships by managing keys "under the covers" exactly as I described previously. Take a look at this page:
http://code.google.com/appengine/docs/java/datastore/relationships.html What they describe as "unowned relationships" is exactly what I described previously for my BlogCFC implementation--the programmer manages the keys manually himself. What they describe as "owned relationships" are a set of conventions and persistence annotations that let the JDO layer handle the key management automatically (again, very similar to what I described for a future enhancement for BD, so we have a good model to mimic). The only limit I can find is that a datastore Entity (the fundamental unit of storage in the GAE datastore) is limited to 1MB. Each "relationshp" is basically a Key, so I'd guess you can have as many as you want until you break the 1MB entity limit. Even then, the JDO layer (or BD CFC persistence layer) could exceed that limit by "chaining" entities. Same for strings--you're limited to 1MB unless you implemented some sort of entity chaining mechanism to exceed this limit. Vince On Jun 2, 4:02 pm, Baz <[email protected]> wrote: > > The GAE datastore has the concept of relationships. It is implemented by > saving a collection of the related objects in a specific attribute. So if > you have a blog that has comments. You store a collection of comment objects > inside the blog attribute called 'comments'. If a second blog entry > references the same comment (which is wierd in this context I know) then > that comment is the same root comment for both entries. A change to that > comment will be reflected in both entries. > > So I was just wondering (couldn't find it in the docs) if you knew what the > limit was of related objects for a given attribute. Can you have 1000 > comments stored in the "Comments" attribute of the "BlogPost" object? What > about 10,000 or a million? there must be some limit. > > Similarly whats the longest string you can store in a string field - one mb? > > Baz > > > > On Tue, Jun 2, 2009 at 11:53 AM, <[email protected]> wrote: > > > I'm not sure what the definitions of "relationships" and "attribute" > > are in this context. Can you elaborate on the question? > > > Vince > > > On Jun 2, 1:43 pm, Baz <[email protected]> wrote: > > > > Do you know the max number of relationships allowed in 1 attribute? > > > > Baz > > > > On Tue, Jun 2, 2009 at 10:24 AM, <[email protected]> wrote: > > > > > Yes, obviously when you get to that extreme (10,000 CFC instances) the > > > > developer is going to have to get smart about designing and accessing > > > > the datastore. Note that the CFQUERY and GoogleQuery syntax supports a > > > > "range" clause. When you get up to 10,000 entries, it might start to > > > > make more sense to query the datastore ("select from blogEntry where > > > > category = '#categoryName#' range 1,100") rather than doing batch > > > > reads based on keys. > > > > > Vince > > > > > On Jun 2, 1:06 pm, Baz <[email protected]> wrote: > > > > > > > Instead, I store the Google keys for the blogEntry.cfc instances > > > > > > within the blogCategory.cfc and read the blogEntry.cfc instances > > only > > > > > > when needed. > > > > > > If you had 10,000 blog entries or more this will probably break the > > app > > > > > because you would reach the attribute length limit (which I can't > > seem to > > > > > find, what is the max attribute size?). In cases like this, when it > > comes > > > > to > > > > > OO db's, I think it is recommended to choose the smaller side of the > > > > > relationship to store your data. So instead of storing all posts that > > a > > > > > category is related too in the category object, you would store all > > > > > categories a post is related to in the post object - there will only > > be a > > > > > few categories per post. To retrieve all posts for a certain category > > > > then, > > > > > you would do: > > > > > > SELECT FROM Post WHERE Category = 'App Engine' > > > > > > Baz- Hide quoted text - > > > > - Show quoted text -- Hide quoted text - > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ Open BlueDragon Public Mailing List http://groups.google.com/group/openbd?hl=en official site @ http://www.openbluedragon.org/ !! save a network - trim replies before posting !! -~----------~----~----~----~------~----~------~--~---
