app-engine-ndb

Memory leak in Google ndb library

 ̄綄美尐妖づ 提交于 2019-12-13 01:37:12
问题 I think there is a memory leak in the ndb library but I can not find where. Is there a way to avoid the problem described below? Do you have a more accurate idea of testing to figure out where the problem is? That's how I reproduced the problem : I created a minimalist Google App Engine application with 2 files. app.yaml : application: myapplicationid version: demo runtime: python27 api_version: 1 threadsafe: yes handlers: - url: /.* script: main.APP libraries: - name: webapp2 version: latest

How to assign default value to all NDB datastore entries?

岁酱吖の 提交于 2019-12-12 16:24:59
问题 I have to add one new property to my existing NDB class: class AppList(ndb.Model): ... ignore = ndb.BooleanProperty(default=False) # new property Then I will use it like below: entries = AppList.query() entries = entries.filter(AppList.counter > 5) entries = entries.filter(AppList.ignore == False) entries = entries.fetch() I can not use AppList.ignore != True to catch early added records (which don't have ignore property), so I have to assign False for all records in my AppList entity. What

NDB: Sort query results

可紊 提交于 2019-12-12 15:25:19
问题 In App Engine NDB, I am querying entities that have a repeated property. I would like to order the result by the length of the array representing that property. What I wish I could do: Entity.query(...).order(len(Entity.repeatedProp)) 回答1: You'll need to add an ndb.IntegerProperty() to your entity where you will store the length of the repeated property. Every time you change your repeated property, you'll need to update the stored length. Then you sort based on that stored length. You could

NDB query returns zero results. Datastore shows the result

醉酒当歌 提交于 2019-12-12 15:24:09
问题 I found this peculiar problem where running a Query, confirming the record exists, returns a count of zero. Here are my models: class Description(ndb.Model): description = ndb.TextProperty() time_posted = ndb.DateTimeProperty(auto_now_add=True) uuid = ndb.StringProperty() class Examine(ndb.Model): updated = ndb.DateTimeProperty(auto_now=True, auto_now_add=True) descriptions = ndb.StructuredProperty(Description, repeated=True) active = ndb.KeyProperty(kind=Description) slug = ndb

In ndb, how to query for items where property A is not in list B?

怎甘沉沦 提交于 2019-12-12 12:04:05
问题 In ndb, in order to query for items where property A is in list B , you can do something like: Item.query(Item.A.IN(B)) How can you query for items where property A is not in list B? 回答1: It's not possible. Note that your IN query is actually automatically broken down into a number of different EQUALS queries, for each item in list B, and the merged results are returned. You could query for all, and then manually filter out and ignore results that are in list B. A typical GAE solution would

Processing a large (>32mb) xml file over appengine

﹥>﹥吖頭↗ 提交于 2019-12-12 10:05:26
问题 I'm trying to process large (~50mb) sized xml files to store in the datastore. I've tried using backends, sockets (to pull the file via urlfetch), and even straight up uploading the file within my source code, but again keep running into limits (i.e. the 32 mb limit). So, I'm really confused (and a little angry/frustrated). Does appengine really have no real way to process a large file? There does seem to be one potential work around, which would involve remote_apis, amazon (or google compute

How to query for newly created property in NDB?

六月ゝ 毕业季﹏ 提交于 2019-12-12 05:34:48
问题 I had NDB class before and added new property receive_news just now: class User(ndb.Model): ''' Index Key: user_id ''' lang = ndb.StringProperty(required=None, indexed=True) receive_news = ndb.BooleanProperty(required=None, indexed=True) I would like to get list of users, who would like to receive my news (all users currently). I tried the following options: keys = User.query(User.receive_news != True).fetch(keys_only=True) keys = User.query(User.receive_news == None).fetch(keys_only=True)

Google App Engine - How could I do python ndb query on results returned by a ndb query?

五迷三道 提交于 2019-12-12 04:15:28
问题 I am using GAE python (webapp2) framework for a project and have a question related to ndb query. Let me give an example to explain this clearly: Here is a ndb model I have: class Example(ndb.Model): userid = ndb.StringProperty() field1 = ndb.StringProperty() field2 = ndb.StringProperty() Here are the entities I have created using the above model: [Example(key=Key('Example', '1~A~B'), field1=u'B', field2=u'A', userid=u'1'), Example(key=Key('Example', '1~C~D'), field1=u'D', field2=u'C', userid

How to avoid returning of None values with GAE NDB?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-12 04:08:36
问题 I have complex NDB query like below: employees = Employee.query(query.OR(Employee.passport_id == passport_id, Employee.inn == inn, query.AND(Employee.last_name == last_name, Employee.region == region, Employee.prof_area == prof_area), query.AND(Employee.last_name == last_name, Employee.first_name == first_name, Employee.date_of_birth == date_of_birth) )) Currently when database value is None and my value is None , such entity is returned. How can I avoid that? I think I can do something like

Can you help me understand the nbd Key Class Documentation or rather ancestor relationship?

放肆的年华 提交于 2019-12-12 04:07:11
问题 I am trying to wrap my head 'round gae datastore, but I do not fully understand the documentation for the Key Class / or maybe it is ancestor relationships in general I do not grasp. I think what I want is multiple ancestors. Example: Say I wanted to model our school's annual sponsored run for charity; school kids run rounds around the track and their relatives (=sponsors) donate to charity for each round completed. In my mind, I would create the following kinds: Profile (can be both runner