Hi Manny,

A few things to first remember - App Engine's datastore is not a database,
but a distributed key value store with additional features. Thus, we should
be careful not to frame our thinking in terms of RDBMS schemas. For this
reason, I like to avoid using database terminology that can confound the
design process like "table" or "column". App Engine stores objects
serialized ("entities") and indexes on the values. It'd be similar to an
approach of creating a MySQL table with a String ID and a blob value,
storing serialized Objects in the blob column, or using Memcache and storing
JSON values.

When you retrieve a single value from the key value store, we have to
retrieve everything at once. In most scenarios, unlike SQL databases you may
be used to, retrieving large binary or text data does not add serious
overhead. Of course, this changes if you start storing data on the scale of
1mb and are retrieving it unnecessarily. How large is the data you are
retrieving?

Here's the way I would model your scenario if I was positive the text/binary
field had a 1:1 relationship with the parent class:

* on your main entity, define the properties.
* define a new entity with a text/binary field, and encode the parent key
information in this key such that generating the key for this child field is
very cheap. KeyFactory.stringToKey and KeyFactory.keyToString are crucial
here. Read more about them here:
http://code.google.com/appengine/docs/java/javadoc/com/google/appengine/api/datastore/KeyFactory.html.
You can call your child property "parent_id:additional_info" or whatever
makes sense to you.

Robert's solution of using a child key is basically just a variation on
this, as parent key information is encoded in a child key.

A lot of this stuff can be a bit different to get used to. I suggest
becoming familiar with keys and how they are used in App Engine:

Basic documentation about relationships:
http://code.google.com/appengine/docs/java/datastore/relationships.html
A more advanced article:
http://code.google.com/appengine/articles/storage_breakdown.html

On Thu, Jan 28, 2010 at 10:28 PM, Manny S <manny.m...@gmail.com> wrote:

> Hi All,
>
> First off, thanks for your time. A quick noob question on the right way to
> model data.
>
> I have a table with four columns A,B,C, D.  D - the fourth is of type text
> (contains quite a bit of data).
>
> I wanted to ensure that the contents of the details column 'D' is not
> fetched during a query. A sample scenario
> User does a search. Sees Columns A,B,C. If they need more details for that
> particular record Click on a link that fetches D for that particular
> record.
>
> So I tried to do something like - Select A, B, C from tablename.
>
> I found from the documentation that the GQL query returns full data
> objects and so all queries start with SELECT *.  Is this true for JDOQL on
> the datastore as well? Does this mean everytime I query the data store its
> going to return all columns consuming bandwidth?
>
> Also since I want the content of COlumn D to be fetched on subsequent user
> action so should I instead create two tables one with
>
> ID_TB1, A, B, C
>
> and the other one with
>
> ID, ID_TB1, D?
>
> Manny
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine" group.
> To post to this group, send email to google-appeng...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-appengine+unsubscr...@googlegroups.com<google-appengine%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-appengine?hl=en.
>



-- 
Ikai Lan
Developer Programs Engineer, Google App Engine
http://googleappengine.blogspot.com | http://twitter.com/app_engine

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

Reply via email to