google-cloud-datastore

How to update 400,000 GAE datastore entities in parallel?

放肆的年华 提交于 2020-01-02 16:30:27
问题 I have 400,000 entities of a certain type, and I'd like to perform a simple operation on each of them (adding a property). I can't process them serially because it would take forever. I don't want to use the MapReduce library because it is complicated and overwhelming. Basically I'd like to create 100 tasks on the taskqueue, each task taking a segment of ~4,000 entities and performing this operation on each one. Hopefully this wouldn't take more than a few minutes to process all 400k entities

Complex Class Hierarchy in Google AppEngine (Java)

旧街凉风 提交于 2020-01-02 10:46:51
问题 Is it possible to have multiple classes that inherit/extends same class in Google AppEngine with Java (GAE/J) for my entities (JDO). For example I have: Content (Abstract class) Course and then my Course will have : list of Video that is extends Content list of Books At the same time Video has list of Tags Book has list of Tags Course has list of Tags Is it possible to do it GAE? I'm doing similar to this but having so much problems. Is there any examples of this kind of stuff? 回答1: Update

Complex Class Hierarchy in Google AppEngine (Java)

穿精又带淫゛_ 提交于 2020-01-02 10:45:08
问题 Is it possible to have multiple classes that inherit/extends same class in Google AppEngine with Java (GAE/J) for my entities (JDO). For example I have: Content (Abstract class) Course and then my Course will have : list of Video that is extends Content list of Books At the same time Video has list of Tags Book has list of Tags Course has list of Tags Is it possible to do it GAE? I'm doing similar to this but having so much problems. Is there any examples of this kind of stuff? 回答1: Update

GAE/J Low-level API: FetchOptions usage

和自甴很熟 提交于 2020-01-02 10:15:29
问题 What should I know about FetchOptions withLimit, prefetchSize and chunkSize? The docs say the following: prefetchSize is the number of results retrieved on the first call to the datastore. chunkSize determines the internal chunking strategy of the Iterator returned by PreparedQuery.asIterator(FetchOptions) ... prefetchSize and chunkSize have no impact on the result of the PreparedQuery, but rather only the performance of the PreparedQuery. I'm not too sure how to use that in anger. What are

Flattening nested structs leads to a slice of slices

﹥>﹥吖頭↗ 提交于 2020-01-02 08:04:17
问题 So I have a struct like this type Bus struct { Number string Name string DirectStations []Station // Station is another struct ReverseStations []Station } and I'm trying to store an instance of this to the Datastore: key := datastore.NewKey(c, "Bus", bus.Number, 0, nil) _, err := datastore.Put(c, key, &bus) but I'm getting the error datastore: flattening nested structs leads to a slice of slices: field "DirectStations" How does one solve this? Edit: Turns out you can't have a slice of struct,

Can Java and Python coexist in the same app?

自闭症网瘾萝莉.ら 提交于 2020-01-02 05:40:12
问题 I need to have a Java instance fetching data directly from the Python's instance datastore. I don't know if that's possible at all. Is the datastore transparent/unique, or each instance (if they can indeed coexist) has its separate datastore? Suming it up: how can a Java app fetch data from the datastore of a Python app, and vice-versa? 回答1: You could use jython. It's a python implementation written in java. You can call java functions/classes from python that way. That would allow you to run

How can I store the date with datastore?

泪湿孤枕 提交于 2020-01-02 05:11:05
问题 Datastore documentation is very clear that there is an issue with "hotspots" if you include 'monotonically increasing values' (like the current unix time), however there isn't a good alternative mentioned, nor is it addressed whether storing the exact same (rather than increasing values) would create "hotspots": "Do not index properties with monotonically increasing values (such as a NOW() timestamp). Maintaining such an index could lead to hotspots that impact Cloud Datastore latency for

How to read old property values in a _pre_put_hook

烂漫一生 提交于 2020-01-02 02:06:27
问题 I am trying to implement an ndb model audit so that all changes to properties are stored within each model instance. Here is the code of the _pre_put_hook I chose to implement that. def _pre_put_hook(self): # save a history record for updates if not (self.key is None or self.key.id() is None): old_object = self.key.get(use_cache=True) for attr in dir(self): if not callable(getattr(self, attr)) and not attr.startswith("_"): if getattr(self, attr) != getattr(old_object, attr): logging.debug(

A convenient way to preload data in development environment datastore

為{幸葍}努か 提交于 2020-01-01 19:58:05
问题 I'm developing an application on Google App Engine using Maven. When I run the local server I would like to have some data preloaded in the datastore, such as the local user table. The server puts the datastore file under the WEB-INF/appengine-generated of the target directory and it is cleaned before every build. Is there a convenient way to do so? 回答1: You have a couple of options: a. backup and reload local_db.bin in your build steps b. use the datastore.backing_store system property with:

Duplicate entries in High Replication Datastore

旧巷老猫 提交于 2020-01-01 19:40:42
问题 We still have a rare case of duplicate entries when this POST method is called. I had asked for advice previously on Stack overflow and was given a solution, that is utilising the parent/child methodology to retain strongly consistent queries. I have migrated all data into that form and let it run for another 3 months. However the problem was never solved. The problem is right here with this conditional if recordsdb.count() == 1: It should be true in order to update the entry, but instead HRD