One other thing, if your subscription model is really that simple you might look into using a relation index: http://code.google.com/events/io/2009/sessions/BuildingScalableComplexApps.html
Robert On Wed, Jul 21, 2010 at 2:51 AM, Robert Kluin <[email protected]> wrote: > Hey Carl, > What about just making the subscription's key_name something like > "customer.key().id_or_name()-service.key().id_or_name()". That will prevent > duplicating subscriptions. > > > Robert > > > > On Jul 20, 2010, at 23:42, cwaldbieser <[email protected]> wrote: > >> I have 3 models: A customer account, a service, and a model that >> represents a customer's subscription to the service. The subscription >> is essentially: >> >> class Subscription(db.Model): >> customer = db.ReferenceProperty(Customer) >> service = db.ReferenceProperty(Service) >> >> I have a user interface that allows creating or cancelling a >> customer's subscription. I want to be able to create a subscription >> only if an existing subscription does not already exist. I thought >> that a transaction might be the key, but I can't do a query in >> transaction unless it is by key or an ancestor query. So I am not >> sure what to do. >> >> Any thoughts? >> >> Thanks, >> Carl >> >> -- >> 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.
