[google-appengine] Re: ndb, get_by_id can not get an entity with a parent key only by id?

2014-07-26 Thread saintthor
thanks. 在 2014年7月26日星期六UTC+8上午9时02分35秒,Jay写道: I just deployed a little test app. It is under quota so I don't think appstats is reporting that for me. However, the important thing to note in this context is that whether I use the db api or ndb, it is the same datastore operation ... which

[google-appengine] Re: ndb, get_by_id can not get an entity with a parent key only by id?

2014-07-25 Thread saintthor
how many entities is in your db? how many ops cost for one call? 在 2014年7月25日星期五UTC+8上午8时03分44秒,Jay写道: I wrote a simple test app that used both the db and ndb api and deployed it to app engine. Using appstats I confirmed that both RunQuery when getting the list of articles. On Wednesday,

Re: [google-appengine] Re: ndb, get_by_id can not get an entity with a parent key only by id?

2014-07-25 Thread Vinny P
On Fri, Jul 25, 2014 at 9:26 AM, saintthor saintt...@gmail.com wrote: how many entities is in your db? how many ops cost for one call? Perhaps you could post a test case application demonstrating what you're seeing and the size/content of your entities? It would make this conversation flow a

[google-appengine] Re: ndb, get_by_id can not get an entity with a parent key only by id?

2014-07-25 Thread Jay
I just deployed a little test app. It is under quota so I don't think appstats is reporting that for me. However, the important thing to note in this context is that whether I use the db api or ndb, it is the same datastore operation ... which is a query in this case. If you still need proof,

[google-appengine] Re: ndb, get_by_id can not get an entity with a parent key only by id?

2014-07-24 Thread Jay
I wrote a simple test app that used both the db and ndb api and deployed it to app engine. Using appstats I confirmed that both RunQuery when getting the list of articles. On Wednesday, July 23, 2014 8:03:40 PM UTC-5, Jay wrote: I refer you to line 3865 of __init__ in the ext.db package in

[google-appengine] Re: ndb, get_by_id can not get an entity with a parent key only by id?

2014-07-23 Thread saintthor
are you sure? i tested in two apps. the first is using query. when i do a query, the read ops increases about 300. the second is using referenceproperty as above, after 5 times showing, there is no obviously increase. the articles in the second app is much more than the first. so i don't

[google-appengine] Re: ndb, get_by_id can not get an entity with a parent key only by id?

2014-07-23 Thread Jay
I refer you to line 3865 of __init__ in the ext.db package in the sdk. This is on a _ReverseReferenceProperty that gets setup. If I have time tomorrow I will write a quick test to demonstrate. On Wednesday, July 23, 2014 11:11:31 AM UTC-5, saintthor wrote: are you sure? i tested in two apps.

[google-appengine] Re: ndb, get_by_id can not get an entity with a parent key only by id?

2014-07-22 Thread Jay
When you use that api in db, it is doing a query underneath the covers. On Monday, July 21, 2014 11:27:08 PM UTC-5, saintthor wrote: in db, i set such a property in model article: auth = db.ReferenceProperty( author, collection_name=AuthSet ) and use author.AuthSet to get all articles

[google-appengine] Re: ndb, get_by_id can not get an entity with a parent key only by id?

2014-07-22 Thread Jay
I am not a Google guy, but I think I can answer your question. key.parent does exactly what it says it does, gives the key of the parent of the key you have. So it is useful when you need that. An example might be if you have the key to a comment on an article (and you have set it up such that

[google-appengine] Re: ndb, get_by_id can not get an entity with a parent key only by id?

2014-07-21 Thread saintthor
hi, are you a google guy? what do you think the real usage of the key group ( or tree ) is? for example, a forum, user entity and article entity, i set article.author to user entity, then how can i get all articles for a user? in db, i can set it with referenceproperty and get a _set ended

[google-appengine] Re: ndb, get_by_id can not get an entity with a parent key only by id?

2014-07-21 Thread Kaan Soral
Not associated with google, also not an expert on ndb As far as I know key groups are related with consistency, in my opinion, you shouldn't put article's and author's in the same group, there is a 1/s write speed limit on entity groups, if you put them in the same entity group, you could hit

[google-appengine] Re: ndb, get_by_id can not get an entity with a parent key only by id?

2014-07-21 Thread saintthor
to query may cost too many ops. i don't query. 在 2014年7月21日星期一UTC+8下午8时53分29秒,Kaan Soral写道: Not associated with google, also not an expert on ndb As far as I know key groups are related with consistency, in my opinion, you shouldn't put article's and author's in the same group, there is a

[google-appengine] Re: ndb, get_by_id can not get an entity with a parent key only by id?

2014-07-21 Thread Jay
Responding to your first post ... that is right. The parent key is part of the entity's key. When you use get_by_id, this is just shorthand for Key('Foo', 99).get(). You cannot get an entity by key unless you know the key, the whole key. You say you don't want to query, but your use case ...

[google-appengine] Re: ndb, get_by_id can not get an entity with a parent key only by id?

2014-07-21 Thread saintthor
in db, i set such a property in model article: auth = db.ReferenceProperty( author, collection_name=AuthSet ) and use author.AuthSet to get all articles written by the certain author. there is no query. how can i do the same thing in ndb? 在 2014年7月22日星期二UTC+8上午3时55分28秒,Jay写道: Responding

[google-appengine] Re: ndb, get_by_id can not get an entity with a parent key only by id?

2014-07-21 Thread saintthor
and, if you were a google guy, i'd like to ask what do you think the usage of key.parent is? in what instance it may be useful? 在 2014年7月22日星期二UTC+8上午3时55分28秒,Jay写道: Responding to your first post ... that is right. The parent key is part of the entity's key. When you use get_by_id, this is

[google-appengine] Re: ndb, get_by_id can not get an entity with a parent key only by id?

2014-07-20 Thread Kaan Soral
I've also tested utilizing parent's recently, don't remember the exact reason I've found out that you can't get an entity only by id, if it has a parent, you have to know the parent too, that's why I utilized a different method to achieve whatever I was after at that time (don't remember) I