google-cloud-datastore

Duplicate entries in High Replication Datastore

半城伤御伤魂 提交于 2020-01-01 19:40:10
问题 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

appengine bulkdownloader to xml with nested entities

空扰寡人 提交于 2020-01-01 17:07:47
问题 I've got an appengine app with two simple kinds of entities - ParentEntity s and ChildEntity s. Each ParentEntity has a List of owned ChildEntity s. @PersistenceCapable public class ParentEntity { @PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) private Key key; @Persistent private String name; @Persistent(defaultFetchGroup=true) private List<ChildEntity> children; ... With ChildEntity similarly defined. Now, I want to download all of my data from the datastore using the

Sending and retreaving data from datastore with mobile backend starter

£可爱£侵袭症+ 提交于 2020-01-01 14:59:46
问题 I'm trying to use Mobile Backend Starter in my Android application. In order to do that I need to store some data in the Datastore. I'm using the provided object CloudEntity but I can only consistently insert and read String . That's the example code I used to send data: CloudEntity entity = new CloudEntity(TEST_KIND_NAME); entity.put(KEY_DATE, new Date(System.currentTimeMillis())); entity.put(KEY_CALENDAR, Calendar.getInstance()); entity.put(KEY_LONG, Long.valueOf(Long.MAX_VALUE)); entity

Sending and retreaving data from datastore with mobile backend starter

。_饼干妹妹 提交于 2020-01-01 14:59:34
问题 I'm trying to use Mobile Backend Starter in my Android application. In order to do that I need to store some data in the Datastore. I'm using the provided object CloudEntity but I can only consistently insert and read String . That's the example code I used to send data: CloudEntity entity = new CloudEntity(TEST_KIND_NAME); entity.put(KEY_DATE, new Date(System.currentTimeMillis())); entity.put(KEY_CALENDAR, Calendar.getInstance()); entity.put(KEY_LONG, Long.valueOf(Long.MAX_VALUE)); entity

Unable to get ID of newly-created JDO persistent entity using GAE/J DataNucleus plug-in version 2.1.2

[亡魂溺海] 提交于 2020-01-01 12:07:05
问题 My problem I am porting my application from version 1.x to 2.0 of the DataNucleus plug-in for GAE/J using the new 1.7.5 GAE/J SDK. This changes my JDO version from 2.3 to 3.0.1. My persistent entity class has a primary key of type encoded string, along with read-only access to the object’s numeric ID. Each instance is the sole member of its entity group (children and parent are linked by numeric ID only). Previously, I have been able to create and persist a new MyEntity instance and then

What's the equivalent of Entity.all(keys_only=True).fetch(20) in NDB?

♀尐吖头ヾ 提交于 2020-01-01 08:43:38
问题 How do I get the equivalent result of the following query in NDB? Entity.all(keys_only=True).fetch(20) I know you can pass 'keys_only=True' to the iter() method. But what if I want to perform a keys only fetch, how do I do that in NDB? 回答1: Found it in the GAE NDB Docs. The answer is Entity.query().fetch(20,keys_only=True) . 来源: https://stackoverflow.com/questions/10203874/whats-the-equivalent-of-entity-allkeys-only-true-fetch20-in-ndb

GAE Go — How to use GetMulti with non-existent entity keys?

╄→гoц情女王★ 提交于 2020-01-01 04:39:05
问题 I've found myself needing to do a GetMulti operation with an array of keys for which some entities exist, but some do not. My current code, below, returns an error ( datastore: no such entity ). err := datastore.GetMulti(c, keys, infos) So how can I do this? I'd use a "get or insert" method, but there isn't one. 回答1: GetMulti can return a appengine.MultiError in this case. Loop through that and look for datastore.ErrNoSuchEntity. For example: if err := datastore.GetMulti(c, keys, dst); err !=

Store ordered list in database (Gap approach)

余生颓废 提交于 2020-01-01 03:03:49
问题 I want to keep a large ordered list (millions of elements) in Google App Engine datastore. Fast insertion is required. The simplest way would be adding an indexed property (or column) "order_num" representing the order. For example, a list [A, B, C] would be stored like this: content order_num -------------------- A 1 B 2 C 3 However, this doesn't give you fast insertion. For example, If I want to insert X after A, I have to renumber B and C to "make room" for X, i.e., let B become 3, C

App Engine: How to “reset” the datastore?

主宰稳场 提交于 2019-12-31 08:45:12
问题 Well, I'm developing in App Engine (Java) and after a lot of tries and deployments, I need to reset the datastore. There is a lot of random data I added to test performance, and besides that the entities changed a lot, so I need to delete all: data, tables, indexes. How can I do that? 回答1: There is no built in command equivalent to DROP TABLE or TRUNCATE TABLE in SQL. You just need to create a "delete everything" page in your app, then repeatedly call that page via a script. In that page, you

Custom keys for Google App Engine models (Python)

大憨熊 提交于 2019-12-31 08:40:07
问题 First off, I'm relatively new to Google App Engine, so I'm probably doing something silly. Say I've got a model Foo: class Foo(db.Model): name = db.StringProperty() I want to use name as a unique key for every Foo object. How is this done? When I want to get a specific Foo object, I currently query the datastore for all Foo objects with the target unique name, but queries are slow (plus it's a pain to ensure that name is unique when each new Foo is created). There's got to be a better way to