Re: [google-appengine] Confusion about key names

2011-03-06 Thread cool-RR
Oh, thanks for that Robert! You saved me some future debugging :)


Ram.

On Sun, Mar 6, 2011 at 1:33 AM, Robert Kluin robert.kl...@gmail.com wrote:

 Just a note, get an entity that matches the keywords I supply is
 _not_ what Model.get_or_insert does.  It fetches the entity with the
 given key name, and if and only if the entity does not exist it will
 create one with the given arguments.



 Robert





 On Sat, Mar 5, 2011 at 11:50, Ram Rachum ram.rac...@gmail.com wrote:
  Hello,
  I'm very confused about the whole key and key-name thing in GAE.
  What's the job of the key-name? Is this documented anywhere? I couldn't
 find
  it in the docs.
  For example, when I use `Model.get_or_insert`, why do I need to provide a
  `key_name`? I want to get an entity that matches the keywords I supply,
 or
  create one if one doesn't exist. Why do I need to put in a key name? What
  does it do? Is it stored on the object somehow? What will happen if I put
 in
  bla bla bla?
 
  Frustratedly yours,
  Ram.
 
  --
  You received this message because you are subscribed to the Google Groups
  Google App Engine group.
  To post to this group, send email to google-appengine@googlegroups.com.
  To unsubscribe from this group, send email to
  google-appengine+unsubscr...@googlegroups.com.
  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 google-appengine@googlegroups.com.
 To unsubscribe from this group, send email to
 google-appengine+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/google-appengine?hl=en.




-- 
Sincerely,
Ram Rachum

-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine group.
To post to this group, send email to google-appengine@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.



Re: [google-appengine] Confusion about key names

2011-03-06 Thread cool-RR
Cool, thanks everyone!

On Sat, Mar 5, 2011 at 7:59 PM, Calvin calvin.r...@gmail.com wrote:

 myKey = db.Key.from_path('kind', 'key_name')
 myEntity = db.get(myKey)

 -or-

 myEntity = MyKind.get_by_key_name('key_name')

 --
 You received this message because you are subscribed to the Google Groups
 Google App Engine group.
 To post to this group, send email to google-appengine@googlegroups.com.
 To unsubscribe from this group, send email to
 google-appengine+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/google-appengine?hl=en.




-- 
Sincerely,
Ram Rachum

-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine group.
To post to this group, send email to google-appengine@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.



Re: [google-appengine] Confusion about key names

2011-03-05 Thread cool-RR
So how would I retrieve an entity given only its kind and key-name? (I use
Python.)

On Sat, Mar 5, 2011 at 12:13 PM, djidjadji djidja...@gmail.com wrote:

 The Kind (db.Model) together with the key_id or key_name is the
 address of the object to read or write.
 Also the name space and app_id are part of this address (the db.Key)
 The SQL equivalent is table_name-row_id.

 2011/3/5 Ram Rachum ram.rac...@gmail.com:
  Hello,
  I'm very confused about the whole key and key-name thing in GAE.
  What's the job of the key-name? Is this documented anywhere? I couldn't
 find
  it in the docs.
  For example, when I use `Model.get_or_insert`, why do I need to provide a
  `key_name`? I want to get an entity that matches the keywords I supply,
 or
  create one if one doesn't exist. Why do I need to put in a key name? What
  does it do? Is it stored on the object somehow? What will happen if I put
 in
  bla bla bla?
 
  Frustratedly yours,
  Ram.
 
  --
  You received this message because you are subscribed to the Google Groups
  Google App Engine group.
  To post to this group, send email to google-appengine@googlegroups.com.
  To unsubscribe from this group, send email to
  google-appengine+unsubscr...@googlegroups.com.
  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 google-appengine@googlegroups.com.
 To unsubscribe from this group, send email to
 google-appengine+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/google-appengine?hl=en.




-- 
Sincerely,
Ram Rachum

-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine group.
To post to this group, send email to google-appengine@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.