[google-appengine] Re: Using referenced class properties in GQL Query WHERE clause

2009-04-15 Thread JDT
A naive question: I note that in this snippet you have User(db.model) and user.email. Is this a python case sensitivity issue? i.e. User != user ? D On Apr 14, 6:04 pm, olex13 wrote: > Hi, > > Is it possible to use referenced-class properties in GQL query, like: > > Thread.gql("WHERE user.email

[google-appengine] Re: Using referenced class properties in GQL Query WHERE clause

2009-04-15 Thread olex13
Hmm, didn't get your point Here: -- class Thread(db.Model) user = dbReferenceProperty(User) -- User - name of referenced class user - field name in Thread class so I'm trying to navigate on the field property: Thread.gql("WHERE user.email = :1", email) PS well, I checked: Thread.gql("WHER

[google-appengine] Re: Using referenced class properties in GQL Query WHERE clause

2009-04-15 Thread 风笑雪
Seems you can do it. Remember it: it's not a relationship DB, you should organize an entity as how you use it. If you just want email to identify a thread, you can simply define: class Thread(db.Mode): email = db.EmailProperty() or this is ok too: class Thread(db.Mode): user = db.UserPropert

[google-appengine] Re: Using referenced class properties in GQL Query WHERE clause

2009-04-15 Thread 风笑雪
Sorry I forgot to fetch. user = User.gql('WHERE email = :1', email).get() threads = user.user_set # if they are 1:1 relationship, it would be ok: thread = user.user_set[0] for thread in threads: ... 2009/4/15 风笑雪 > Seems you can do it. Remember it: it's not a relationship DB, you > should org

[google-appengine] Re: Using referenced class properties in GQL Query WHERE clause

2009-04-15 Thread 风笑雪
Well, a mistake again...user.thread_set, not user.user_set Give you an example: class User(db.Model): email = db.EmailProperty() class Thread(db.Model): user = db.ReferenceProperty(User) class Foo(webapp.RequestHandler): def get(self): user = User(email='kea...@gmail.com') user.put

[google-appengine] Re: Using referenced class properties in GQL Query WHERE clause

2009-04-15 Thread olex13
Thank you, explanations are very clear! I will go with this version: class Thread(db.Mode): user = db.UserProperty() user_email = db.EmailProperty() + index on user_email BR, Olex On 15 Кві, 16:01, 风笑雪 wrote: > Well, a mistake again...user.thread_set, not user.user_set > Give you an exam