Thanks Nick, I think adding the list phone_types list to Contact wont solve this, since usually all Contacts have all types of numbers.
>This depends on how many you need to fetch, and what percentage you expect >to be filtered out. Average fetch would be to get 10 Contacts that all have 20-30 phone_numbers, and 90% of the phone numbers would be filtered out. Br, Tomi On 16 syys, 17:41, "Nick Johnson (Google)" <[email protected]> wrote: > On Tue, Sep 15, 2009 at 7:33 PM, Tomi Korhonen <[email protected]>wrote: > > > > > > > Hi guys, > > > I just started learning app engine by developing a small application. > > I am facing following problem: > > > 1) I have following model > > class Contact(db.Model): > > name = db.StringProperty() > > type = db.StringProperty() > > > class PhoneNumber(db.Model): > > contact = db.ReferenceProperty(Contact, > > collection_name='phone_numbers') > > phone_type = db.StringProperty() > > number = db.PhoneNumberProperty() > > > 2) I need to fetch all contacts that are type 'A' and those contacts > > should only contain phone numbers that have phone_type 'B' or 'C' > > The best way to do this is to denormalize: Add "phone_types = > StringListProperty()" to the Contact entity, and populate it with the list > of types that their phone numbers have. > > > 3) I have no idea how to solve this :) (One solution would be fetch > > contacts and filter out "wrong" phone_types at application level, but > > I think that is not best way to solve this) > > This depends on how many you need to fetch, and what percentage you expect > to be filtered out. > > -Nick Johnson > > > > > Thanks in advance, > > Tomi > > -- > Nick Johnson, Developer Programs Engineer, App Engine > Google Ireland Ltd. :: Registered in Dublin, Ireland, Registration Number: > 368047 --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
