google-cloud-datastore

Google Datastore Emulator using Java (Not using GAE)

情到浓时终转凉″ 提交于 2019-12-20 03:29:17
问题 I am using Google Cloud's Datastore Client Library for Java to access the Cloud Datastore. Note : I am not using App Engine to deploy my application; just running a local application for development purposes. Following the example, I can read/write to the Cloud Datastore. Datastore datastore = DatastoreOptions.defaultInstance().service(); KeyFactory keyFactory = datastore.newKeyFactory().setKind("MyKind"); Key key = keyFactory.newKey(); Entity entity = datastore.get(key); I want to be able to

google app engine (spring boot) local testing with data store gives Unauthenticated error

∥☆過路亽.° 提交于 2019-12-20 03:24:24
问题 Google flexible app engine spring boot project running on local with datastore is giving the com.google.cloud.datastore.DatastoreException Unauthenticated exception while saving entity. { "timestamp": 1512077140003, "status": 500, "error": "Internal Server Error", "exception": "com.google.cloud.datastore.DatastoreException", "message": "Unauthenticated.", "path": "/users" } The error description here says the request header does not have valid authentication header, But where to place the

Autoincrement ID in App Engine datastore

柔情痞子 提交于 2019-12-20 02:47:13
问题 I'm using App Engine datastore, and would like to make sure that row IDs behave similarly to "auto-increment" fields in mySQL DB. Tried several generation strategies, but can't seem to take control over what happens: the IDs are not consecutive, there seem to be several "streams" growing in parallel. the ids get "recycled" after old rows are deleted Is such a thing at all possible ? I really would like to refrain from keeping (indexed) timestamps for each row. 回答1: It sounds like you can't

Google cloud datastore only store unique entity

依然范特西╮ 提交于 2019-12-20 02:42:17
问题 I am trying to learn NoSQL with Google Datastore but I am running into a problem with uniqueness. Consider an ecommerce store, it has categories and products. You do not want two products of the same SKU in the database. So I insert an entity with JSON: {"sku": 1234, "product_name": "Test product"} And it shows up with two fields. But then I can do that again and I have two or more identical products. How do you avoid this? Can you make the sku field unique? Do I need to do a query before

GAE: How long to wait for eventual consistency?

纵饮孤独 提交于 2019-12-20 02:32:57
问题 I have an app where I am creating a large number of entities. I don't want to put them in the same entity group, because I could be creating a lot of them in a short period of time -- say 1 million in 24 hours. At certain points, I want to get all of these entities with a query like this: Foo.all() How long do I need to wait after the last Foo entity is created to be highly likely to get all of the Foo entities with this query? EDIT: From this question, it seems that I can't get all my

Can I use SQLite libraries on google app engine?

雨燕双飞 提交于 2019-12-20 02:16:22
问题 I'm currently using Google Datastore for storing data. I want to keep an offline version in the form of sql database. Is it possible to use sqlite on google app engine to convert datastore into sql database? 回答1: No, it is not possible to use sqlite on AppEngine. Currently there is no option to convert data from the AppEngine datastore to a SQL database. 回答2: You can do this locally since Python Development Server v1.7.6 (link outdated) https://developers.google.com/appengine/docs/python

What is the cost difference between paging with a cursor or using offset?

核能气质少年 提交于 2019-12-19 19:57:26
问题 When creating a results page with [Next Page] and [Prev Page] buttons, what is the cost difference between using a cursor to do this or using offset? And what are the pros and cons of each technique? As a concrete example, what is the cost of reading results 100-110. I have seen claims that offset uses "small datastore operations" and some that claim it uses a full "read operation" for each entity skipped. Using cursors, I have read that they cannot page backwards, but I noticed a new Cursor

Create-or-Err with Objectify

假装没事ソ 提交于 2019-12-19 11:17:51
问题 I'm getting started with Google App Engine, and I'm using Objectify. How do I create a root entity in the data store, but err if it already exists? I didn't find anything built in for this (e.g. DatastoreService.put() and therefore ofy().save() will overwrite an existing entity instead of err). The simple technique I am used to is to do this in a transaction: Err if already exists Save However, that is not idempotent; it would err in step 1 if the transaction executes twice. Here is the best

Create-or-Err with Objectify

自古美人都是妖i 提交于 2019-12-19 11:17:28
问题 I'm getting started with Google App Engine, and I'm using Objectify. How do I create a root entity in the data store, but err if it already exists? I didn't find anything built in for this (e.g. DatastoreService.put() and therefore ofy().save() will overwrite an existing entity instead of err). The simple technique I am used to is to do this in a transaction: Err if already exists Save However, that is not idempotent; it would err in step 1 if the transaction executes twice. Here is the best

In Google App Engine, how can I work with eventual consistency in handling form submissions?

时光总嘲笑我的痴心妄想 提交于 2019-12-19 08:41:10
问题 I've noticed that, with eventual consistency, the common form-processing workflow that I am used to (submit -> create/update record -> redirect -> reload) doesn't work. Upon redirect, the new record (probably) won't be available for display. How should I handle forms so that updates are displayed upon reload? I could try to use strong consistency, but as the App Engine documentation notes, updates are limited to one update per second. So how can I process a form providing immediate user