google-cloud-datastore

Query with paging by cursor causes error because of limitations for “IN filter” in cursor() method… What should be the alternative?

偶尔善良 提交于 2019-11-28 05:51:56
问题 I am developing a twitter like microblogging system by using the following models: class Member(db.Model): user = db.UserProperty(required=True) follower_count = db.IntegerProperty(default=0) # members following you following_count = db.IntegerProperty(default=0) # members you are following class NewsItem(db.Model): text = db.StringProperty(required=True) posted_by = db.ReferenceProperty(reference_class=Member,required=True,collection_name="posted_items") posted_on = db.DateTimeProperty(auto

Is there an Entity Group Max Size?

社会主义新天地 提交于 2019-11-28 05:40:14
问题 I have an Entity that represents a Payment Method. I want to have an entity group for all the payment attempts performed with that payment method. The 1 write-per-second limitation is fine and actually good for my use case, as there is no good reason to charge a specific credit card more frequently than that, but I could not find any specifications on the max size of an entity group. My concern is would a very active corporate account hit any limitations in terms of number of records within

How can a multi-property ndb query be successful without a composite index?

瘦欲@ 提交于 2019-11-28 05:32:37
问题 I have this entity model: class ApartCILabel(ndb.Model): project_id = ndb.IntegerProperty(indexed=True) changeset_ids = ndb.IntegerProperty(repeated=True, indexed=True) # ApartCIChangeset IDs # other properties I recently added a new type of query for these entities: keys = ApartCILabel.query(ApartCILabel.project_id == self.db_data.project_id, ApartCILabel.changeset_ids == self.key_id).fetch(keys_only=True) if keys: label = Label(db_key=keys[0], handler=self.handler) logging.debug('label

How to get the distinct value of one of my models in Google App Engine

牧云@^-^@ 提交于 2019-11-28 04:24:31
问题 I have a model, below, and I would like to get all the distinct area values. The SQL equivalent is select distinct area from tutorials class Tutorials(db.Model): path = db.StringProperty() area = db.StringProperty() sub_area = db.StringProperty() title = db.StringProperty() content = db.BlobProperty() rating = db.RatingProperty() publishedDate = db.DateTimeProperty() published = db.BooleanProperty() I know that in Python I can do a = ['google.com', 'livejournal.com', 'livejournal.com',

Best practice to query large number of ndb entities from datastore

删除回忆录丶 提交于 2019-11-28 02:38:35
I have run into an interesting limit with the App Engine datastore. I am creating a handler to help us analyze some usage data on one of our production servers. To perform the analysis I need to query and summarize 10,000+ entities pulled from the datastore. The calculation isn't hard, it is just a histogram of items that pass a specific filter of the usage samples. The problem I hit is that I can't get the data back from the datastore fast enough to do any processing before hitting the query deadline. I have tried everything I can think of to chunk the query into parallel RPC calls to improve

Google Datastore combine (union) multiple sets of entity results to achieve OR condition

吃可爱长大的小学妹 提交于 2019-11-28 02:18:42
I am working with NodeJS on Google App Engine with the Datastore database. Due to the fact that Datastore does not have support the OR operator , I need to run multiple queries and combine the results. I am planning to run multiple queries and then combine the results into a single array of entity objects. I have a single query working already. Question: What is a reasonably efficient way to combine two (or more) sets of entities returned by Datastore including de-duplication? I believe this would be a "union" operation in terms of set theory. Here is the basic query outline that will be run

Can I use AllocateIDs as “string” ? datastore

梦想的初衷 提交于 2019-11-28 01:44:22
I need to assign a unique identifier to each entity in datastore. I've found AllocateIDs but the issue is that it generates integers and I use strings for the keys. Is it safe to convert the integer to a string or there is a risk of collision (i.e. datastore to return me the same integer that I'm currently using as a string key). ? Let's clear some things first: The identifier part of an entity's key can either be a key name string or an integer numeric ID But not both. So when you save an entity, its key either has a string id called name OR (exclusive OR) an int64 id called intID . The 2

Can datastore input in google dataflow pipeline be processed in a batch of N entries at a time?

情到浓时终转凉″ 提交于 2019-11-28 01:11:59
I am trying to execute a dataflow pipeline job which would execute one function on N entries at a time from datastore. In my case this function is sending batch of 100 entries to some REST service as payload. This means that I want to go through all entries from one datastore entity, and send 100 batched entries at once to some outside REST service. My current solution Read input from datastore Create as many keys as there are workers specified in pipeline options (1 worker = 1 key). Group by key, so that we get iterator as output (iterator input in step no.4) Programatically batch users in

Retroactive indexing in Google Cloud Datastore

旧巷老猫 提交于 2019-11-28 00:00:58
There are many properties in my model that I currently don't need indexed but can imagine I might want indexed at some unknown point in the future. If I explicitly set indexed=False for a property now but change my mind down the road, will Datastore rebuild the entire indices automatically at that point, including for previously written data? Are there any other repercussions for taking this approach? Patrick Costello No, changing indexed=True to indexed=False (and vice-versa) will only affect entities written after that point to the datastore. Here is the documentation that talks about it and

How long (max characters) can a datastore entity key_name be? Is it bad to haver very long key_names?

会有一股神秘感。 提交于 2019-11-27 23:04:08
问题 What is the maximum number of characters that can be used to define the key_name of a datastore entity? Is it bad to have very long key_names? For example: Lets say we use key_names of a 170 characters, which is the length of a Twitter message 140 plus 10 numeric characters for latitude and 10 for longtitude and 10 for a timestamp. (Reasoning of such a key_name: So by using such a key_name we can easily and quickly be sure of no duplicate postings, since the same message should not come from