[google-appengine] Query Help: Search for Entity Key within a Kind

2010-12-22 Thread stace
I am using Google App Engine for the backend to my elearning app. I am trying to to a GQL query in the admin dashboard, in order to find ActivityCompletion records for a certain user. The user field (or whatever the non relational equivalent to 'field' is!) is called user, and uses a KEY for th

Re: [google-appengine] Query Help: Search for Entity Key within a Kind

2010-12-22 Thread Stephen Johnson
Where where clause is filtering on the __key__ field of the ActivityCompletion entity and not the User field. I assume it should look something like: where user = Key('User',9122) if user keys or numbers and not strings otherwise where user = Key('User',9122) Also, I'm assuming ActivityCom

Re: [google-appengine] Query Help: Search for Entity Key within a Kind

2010-12-22 Thread Stephen Johnson
Wow I can't type this morning. "Your" where clause is filtering on the __key__ field of the ActivityCompletion entity and not the User field. I assume it should look something like: where user = Key('User',9122) if user keys "are" numbers and not strings otherwise where user = Key('User','

Re: [google-appengine] Query Help: Search for Entity Key within a Kind

2010-12-22 Thread stace
Lovely - works perfect! Sorry to have been such a dunce about this, I'm used to mysql and have quite a bit of trouble getting my brained wrapped around the finer points of the Datastore and using GQL. thanks so much, you've saved me a ton of time. -- You received this message because you are

Re: [google-appengine] Query Help: Search for Entity Key within a Kind

2010-12-22 Thread Stephen Johnson
Not a problem. Glad it was so easy. It is a bit of a mind shift from relational databases. On Wed, Dec 22, 2010 at 10:33 AM, stace wrote: > Lovely - works perfect! Sorry to have been such a dunce about this, I'm > used to mysql and have quite a bit of trouble getting my brained wrapped > around

Re: [google-appengine] Query Help: Search for Entity Key within a Kind

2010-12-22 Thread Stephen Johnson
Just another FYI in case you're not aware of it. You might want to shorten the entity name ActivityCompletion. Your entity names are in all the keys and index entries so long entity names can add a great deal of metadata overhead if you have lots of those entity kinds in the datastore. Otherwise i

Re: [google-appengine] Query Help: Search for Entity Key within a Kind

2010-12-22 Thread stace
Thanks very much for the suggestion - we don't have too many models - just 10 or so - so perhaps now it's OK like this but I will definitely keep that in mind for anything we do next! My programmer disappeared so I'm trying to get a little bit up to speed on GAE, which is an uphill struggle, t

Re: [google-appengine] Query Help: Search for Entity Key within a Kind

2010-12-22 Thread stace
I have another query issue - not sure if I should do a new post or not - but here it is! I'm trying to find Activity types by using their ID/name value - which look like this: *Decoded entity key:* *Activity: name=Lesson/level3gratitude* This doesn't prove as easy as searching for keys that ar

Re: [google-appengine] Query Help: Search for Entity Key within a Kind

2010-12-22 Thread Stephen Johnson
Are you actually putting " where 'name'/ID " in your GQL? Don't you want the following: SELECT * FROM Activity where __key__ = Key('Activity','Lesson/level3gratitude') On Wed, Dec 22, 2010 at 2:00 PM, stace wrote: > I have another query issue - not sure if I should do a new post or not - > b

Re: [google-appengine] Query Help: Search for Entity Key within a Kind

2010-12-22 Thread stace
Yes I am, this is what happens when a GAE moron tries to write GQL queries, lol! Thank you again, your help has made my day! The problem with the samples on the App Engine docs site is that they are not written for people who are starting from ZERO with understanding of using GQL for queries -

Re: [google-appengine] Query Help: Search for Entity Key within a Kind

2010-12-22 Thread Stephen Johnson
Glad to be of help, Stephen On Wed, Dec 22, 2010 at 3:02 PM, stace wrote: > Yes I am, this is what happens when a GAE moron tries to write GQL queries, > lol! > > Thank you again, your help has made my day! > > The problem with the samples on the App Engine docs site is that they are > not writt

Re: [google-appengine] Query Help: Search for Entity Key within a Kind

2010-12-22 Thread Tim Hoffman
Hi You should probably avoid using GQL and stick to Query objects, then you won't keep slipping into the SQL mindset. There is no real benefit in using GQL at all, and is fraught with the semantic problems of looking like SQL but being nothing like it ;-) In addition some things are just a bit