Hi, That is very usefull info. I think the issue regarding fetch ReferenceProperty could be the cause of a performance issue with one of my queries! tks, PJ
On Mon, Apr 6, 2009 at 12:13 PM, Nick Johnson <[email protected]> wrote: > On Mon, Apr 6, 2009 at 12:11 PM, PJ Fitzpatrick < > [email protected]> wrote: > >> Hi, >> That field replication is effectively what i have done in my barter >> application. However i think i am correct in saying that i should only do >> this if i require model1field to be used in a filter. If i need it for >> output i could go >> >> q.Model2().all >> firstrecord = q[0] >> print firstrecord.model1.model1field >> >> and it works. >> > > That's correct, though if you're fetching and displaying a lot of entities, > you should bear in mind that the first access to each referenceproperty > requires a fetch from the datastore. > > >> >> I only got to thinking about the apparent contradiction here when i was >> preparing the presentation. >> >> tks, >> PJ >> >> >> >> >> >> >> On Mon, Apr 6, 2009 at 11:53 AM, Nick Johnson <[email protected]>wrote: >> >>> Because it's not possible. Doing so would require a join, which isn't >>> supported in the App Engine datastore. You need to denormalize your model, >>> and bring model1field in as a property of Model2. >>> >>> -Nick Johnson >>> >>> >>> On Mon, Apr 6, 2009 at 11:42 AM, PJ Fitzpatrick < >>> [email protected]> wrote: >>> >>>> Hi, >>>> Ahead of my talk on wednesday there is one thing i cannot seem to >>>> understand about queries in App Engine. Has anyone got an answer to the >>>> following. >>>> >>>> >>>> I am attempting to query as follows; >>>> >>>> class Model1.(db.Model) >>>> model1field = db.StringProperty() >>>> >>>> class Model2(db.Model) >>>> model1 = db.ReferenceProperty(Model1) >>>> >>>> q= Model2.all() >>>> q.filter("model1.model1field =", somestring) >>>> >>>> Why does this not work? >>>> >>>> tks, >>>> PJ >>>> >>>> >>>> >>>> >>> >>> >>> >> >> >> > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Python Ireland" 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.ie/group/pythonireland?hl=en -~----------~----~----~----~------~----~------~--~---
