Groups
Groups
Sign in
Groups
Groups
Google App Engine
Conversations
Labels
About
Send feedback
Help
Entities and Unique Keys
3 views
Skip to first unread message
Marko Vuksanovic
unread,
May 21, 2008, 12:42:33 PM
5/21/08
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Google App Engine
I've seen that it is not possible to query the datastore by Name/Id
column,.. so i used selfReference property.
def Company(db.Model)
company_id = db.SelfReference()
Then I used method store to save the entity and got the key (the doc
say the put method returns the id of the entity)
key = company.put()
company.company_id = key
company.put()
this saves the key in the datastore but i can't find out how to query
by that key
i tried
SELECT * FROM Company WHERE company_id =
<value_displayed_in_the_data_viewer_in_the_admin_console>
but this does not return any results. I need this information so that
i can pass it as a parameter in a url.
Any idea how i could query by that property....
Thanks
Edoardo Marcora
unread,
May 21, 2008, 12:48:10 PM
5/21/08
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Google App Engine
> I've seen that it is not possible to query the datastore by Name/Id
> column,.. so i used selfReference property.
Sure you can... pass the id/key_name from your url param to
Model.get_by_id(id) or Model.get_by_key_name(key_name)
it's all well explained here
http://code.google.com/appengine/docs/datastore/modelclass.html#Model_get_by_id
Dado
Reply all
Reply to author
Forward
0 new messages