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.