The datastore has no aggregation functions.  To get that type of
summary data you will want to precompute it.

Robert








On Wed, Jan 6, 2010 at 7:15 PM, Daniel Aguilar <[email protected]> wrote:
> Hi Satoshi,
>
> thanks for your reply, it really helped.
> In fact I just read this artile:
> http://code.google.com/appengine/articles/modeling.html
> and have started implementing based on it.
> Still wondering a couple of things, though...
> for instance, in my app I have another class called Collage.
> A collage entity has properties like name, date_created, etc... but also
> layer_0, layer_1 and layer_2, which are references to Photo entities.
> What kind of query could i perform in order to get the most referenced
> Photos?
>
> Thanks again!
>
>
>
> need to keep track of how many times
>
> On Thu, Jan 7, 2010 at 12:51 AM, Satoshi <[email protected]> wrote:
>>
>> First of all, please remember that GAE/database is an Object-database,
>> not a Relational-database. You can design your database with
>> relations, but you will likely hit a roadblock later if you heavily
>> rely on relations (because of the lack of JOIN and the performance
>> problem of nested queries).
>>
>> If I were you, I would simply create two models (Artist and Photo),
>> and have the "artist" property on Photo class, which is just a
>> reference to an Artist entity (ReferenceProperty).  If you want to
>> show all the Photos done by a particular Artist, you just need to
>> query it (Photos.all().filter('artist', ...)).
>>
>> Alternatively, you could specify the Artist entity as the parent
>> entity of each Photo, which essentially creates an entity group for
>> each Artist - which has pros (transactions) and cons (possible
>> performance hit because of transactions).
>>
>> Third alternative is ListProperty, but this is difficult to do it
>> right without putting them in an entity group (which is alternative
>> two)...
>>
>> Satoshi
>>
>> On Jan 5, 9:52 am, Daniel A <[email protected]> wrote:
>> > Hi there,
>> >
>> > I just started writting my first app after reading some documentation
>> > and tutorials.
>> > Looks like an exciting platform to develop on, but there're many
>> > things I still have doubts about.
>> > I used to develop in PHP/MySQL, and I quite don't get how should I
>> > proceed in order to get an efficient relational model.
>> >
>> > To simplify things, I have two kind of entities: Artist and Photo. I
>> > need to define relations one-to-many between instances of these two
>> > entities. That is, an Artist can have many Photos, and a Photo can
>> > only have one Artist.
>> >
>> > In my table-shaped mind, I would model three kinds of entities
>> > (Artist, Photo, ArtistPhotoRelation). Would this approach be the right
>> > thing in GAE/datastore? Maybe I should avoid the relational entity,
>> > and use multiple-valued properties in the Artist instead?
>> >
>> > Thanks a lot!
>>
>> --
>> 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.
>
>
-- 
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