Trying to move away from the standard thinking of relational databases, I
looked around but couldn't find a solid document to get up to speed so I
chose to pick up a fairly complicated scenario and brainstorm about it:

Quick Overview: Trying to model: Students get group Assignments in a Class.
Student can be enrolled in multiple classes. A class can have multiple group
assignments and one student can take part in multiple assignments.

There are quite a few ways you could model this (as mentioned in the docs) -
I chose:

We make an Entity Group: Class being the parent - Assignment, Enrollment,
AssignmentSplit can be its children. Assignment keeps a reference to
Class(One to many relationship),
AssignmentSplit keeps a reference to Assignment and Enrollment (Many to many
relationship). Enrollment keeps a reference to both Student and Class (Many
to many relationship) - it can keep attributes about the student's
performance.

1. Easily retrieve classes enrolled by student.enrollment_set[*].class. How
efficient is this? Is it better to maintain a list of Class keys in Student?
In general, having a ReferenceProperty is how good/bad compared to managing
List of Keys?
2. Retrieve all assignments:
student.enrollment_set[*].assignmentsplit_set[*].assignment. Is this better
or
student.enrollment_set[*].class.assignment_set[*].assignmentsplit[*].filter(enrollment)?
Most probably the former, but just wanted to throw this out there too.
3. What advantages/disadvantages do i get of putting all of this in one
entity group under Class.

http://code.google.com/appengine/articles/modeling.html says I need to be
extra careful with Enrollment and AssignmentSplit as it will generate more
calls to the data store. What alternatives do I have? Whats the most
efficient way to do this?

Advanced twist: What if students can also sign up for assignments outside a
class. In this way, I cant make a concrete Entity Group. Assignment
and AssignmentSplit
still stay as is, but there is no Enrollment. Maybe AssignmentSplit keeps a
reference to Assignment and Student (Many to many relationship). How do I
retrieve these 'open' assignments for a given student?
student.assignmentsplit_set[*]? Will that be really inefficient? Is it
better to keep a List of Assignments or AssignmentSplits in Student? What if
I want to keep some attributes about these open assignments, where would I
keep them, in Student? do I create a special OpenEnrollment? but in either
case, I would have to update it when I update AssignmentSplit in a
transaction meaning they have to be in the same Entity Group. But if I put
Student in there, sooner or later, this entity group would include a lot of
Students and then spoil performance ... Ideas/Thoughts?


Just wanted to throw something out there which has enough One to many / Many
to many issues and also touches on Entity Groups - let me know what you guys
think of this problem, would help me better understand the data store.

Thanks a lot in advance for your time,
Omer

--~--~---------~--~----~------------~-------~--~----~
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