in admin console, how to select a db or ndb entity with gql by id or name?

102 views
Skip to first unread message

saintthor

unread,
Jul 1, 2012, 11:38:00 AM7/1/12
to google-a...@googlegroups.com
ndbModel( id = 'KeyName' ).put()

SELECT * FROM ndbModel where key_name=KEY( 'dbModel', 'KeyName' )
SELECT * FROM ndbModel where name=KEY( 'dbModel', 'KeyName' )
SELECT * FROM ndbModel where key=KEY( 'dbModel', 'KeyName' )
SELECT * FROM ndbModel where id=KEY( 'dbModel', 'KeyName' )

none of the above can get the entity.

Guido van Rossum

unread,
Jul 1, 2012, 3:14:36 PM7/1/12
to google-a...@googlegroups.com
That has nothing to do with ndb; none of those would work with db either. The correct query has "WHERE __key__ = KEY(........)".

saintthor

unread,
Jul 2, 2012, 5:51:37 AM7/2/12
to google-a...@googlegroups.com
thank you.

and, don't you think ndb need this function too?

在 2012年7月2日星期一UTC+8上午3时14分36秒,Guido van Rossum写道:

Guido van Rossum

unread,
Jul 2, 2012, 3:55:37 PM7/2/12
to google-a...@googlegroups.com
I'm sorry, I don't understand. What function do you believe is missing in NDB?

saintthor

unread,
Jul 4, 2012, 10:58:59 AM7/4/12
to google-a...@googlegroups.com
i mean, how to select a ndb entity with id in admin console. maybe i shouldn't use the word 'function'.

since we can select a db entity with "WHERE __key__ = KEY(........)", i think there should be a way for ndb too.

在 2012年7月3日星期二UTC+8上午3时55分37秒,Guido van Rossum写道:

Stephen Lewis

unread,
Jul 4, 2012, 1:46:20 PM7/4/12
to google-a...@googlegroups.com
The datastore itself draws no distinction between 'ndb entities' and 'db entities' - the syntax Guido suggested will should work for entities created via either the ndb or the db API.

Are you unable to query your entities created using the ndb API in the admin console? It works for me...

Stephen

saintthor

unread,
Jul 5, 2012, 12:58:31 AM7/5/12
to google-a...@googlegroups.com
i am sorry. it seems i misunderstanded the word "That has nothing to do with ndb;".

在 2012年7月5日星期四UTC+8上午1时46分20秒,Stephen Lewis写道:

Stephen Lewis

unread,
Jul 5, 2012, 8:49:15 AM7/5/12
to google-a...@googlegroups.com
No need to apologise - I hope you're now able to query as you originally intended.

Stephen
Reply all
Reply to author
Forward
0 new messages