Start with answering the question: Do I need a transaction?

I don't think you need it to delete a team.

Every Team and every Game are root entities, no child objects.

When you want to delete a Team
   1) find all Games that have the Team in attribute team1
   2) delete these Games, maybe delete in groups of 10 to 20 per request
   3) find all Games that have the Team in attribute team2
   4) delete these Games, maybe delete in groups of 10 to 20 per request
   5) delete the Team object

You can use the method from [1] to delete the Games

[1] http://code.google.com/appengine/articles/update_schema.html

2009/4/13 ae <[email protected]>:
>
> Does anybody else find transactions very restricting?  How do I solve
> this problem?  Here is my data model...
>
> Team(db.Model):
>  name = db.StringProperty()
>
> Game(db.Model):
>  team1 = db.ReferenceProperty(Team, collection_name='game1_set')
>  team2 = db.ReferenceProperty(Team, collection_name='game2_set')
>
> ... if I delete a team, I want to delete all the games associated with
> it as well so I need to put the delete operation in a transaction.
> But how would I setup the entity group?
>
> setup 1) Team as parent of Game - but there can be only 1 parent and
> team1 and team2 should both be parents - DOESN'T WORK
> setup 2) Game as parent of Team - then that would mean each team can
> only play 1 game?  DOESN'T WORK
> setup 3) create a 3rd entity and let that be the parent of both Team
> and Game - but then all teams and games would be in the same entity
> group - is this my only option?
>
> Thanks.
> >
>

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