google-cloud-datastore

migrating to HRD “This application does not have access to that blob”

点点圈 提交于 2019-12-25 08:16:21
问题 I just migrated to HRD and now its telling me i cant access my own blobs... Uncaught exception from servlet java.lang.SecurityException: This application does not have access to that blob. at com.google.appengine.api.blobstore.BlobstoreServiceImpl.fetchData(BlobstoreServiceImpl.java:200) at com.droidastic.telljokes.server.servlet.ServeBlobsServlet.checkBlobKeyExists(ServeBlobsServlet.java:100) at com.droidastic.telljokes.server.servlet.ServeBlobsServlet.doGet(ServeBlobsServlet.java:64) 回答1:

how to subclass google app engine ndb property to support python subclassed objects

风格不统一 提交于 2019-12-25 07:35:32
问题 from this article https://stackoverflow.com/a/32107024/5258689 I have a dict() subclass - that allows me to do dict.key (use dot to access keys i mean) - as follows: class Permissions(dict): """ Example: m = Map({'first_name': 'Eduardo'}, last_name='Pool', age=24, sports=['Soccer']) """ def __init__(self, *args, **kwargs): super(Permissions, self).__init__(*args, **kwargs) for arg in args: if isinstance(arg, dict): for k, v in arg.iteritems(): self[k] = v if kwargs: for k, v in kwargs

How to prevent client from changing objectify @ID in Google Cloud Endpoints

痞子三分冷 提交于 2019-12-25 07:30:06
问题 I am using objectify to persist objects to Google Cloud datastore. The "primary key" is annotated with @Id. @Entity class Car { @Id Long id; ... } I generate the client endpoint (using Android Studio). I need getters and setters for all fields, including id, so that REST is able to serialize and deserialize the object. If I don't add getters and setters, then these are created by the Google endpoint builder. Normally, the client GETs an instance from datastore, changes attributes and UPDATEs

Google datastore multiple values for the same property

孤人 提交于 2019-12-25 06:07:13
问题 I am using Google Datastore for an Android application, the backend is written in Java. In one table, I want to set multiple values to the same property: Entity newGroup = new Entity("group"); newGroup.setProperty("member", "A"); newGroup.setProperty("member", "B"); newGroup.setProperty("member", "C"); datastore.put(newGroup); I then want to query to find all groups a user belongs to, I do the following: Query.Filter filter = new Query.FilterPredicate("member", Query.FilterOperator.EQUAL, "A"

Google datastore multiple values for the same property

本小妞迷上赌 提交于 2019-12-25 06:06:10
问题 I am using Google Datastore for an Android application, the backend is written in Java. In one table, I want to set multiple values to the same property: Entity newGroup = new Entity("group"); newGroup.setProperty("member", "A"); newGroup.setProperty("member", "B"); newGroup.setProperty("member", "C"); datastore.put(newGroup); I then want to query to find all groups a user belongs to, I do the following: Query.Filter filter = new Query.FilterPredicate("member", Query.FilterOperator.EQUAL, "A"

GAE GQL - get entity if list contains item

一世执手 提交于 2019-12-25 05:22:08
问题 Say I've got an entity with a StringListProperty: 'ids' - a list of ids associated with the entity. I then want to query for that entity by asking if a given id is in ids. I know you can use filter q.filter("last_name IN", list) but I need the reverse, something like: q.filter('id' IN ids)?? or q = db.GqlQuery("SELECT * FROM entity WHERE :1 IN ids", id) https://developers.google.com/appengine/docs/python/datastore/queries 回答1: It's just q.filter('ids', id) . 来源: https://stackoverflow.com

GAE GQL - get entity if list contains item

浪子不回头ぞ 提交于 2019-12-25 05:22:02
问题 Say I've got an entity with a StringListProperty: 'ids' - a list of ids associated with the entity. I then want to query for that entity by asking if a given id is in ids. I know you can use filter q.filter("last_name IN", list) but I need the reverse, something like: q.filter('id' IN ids)?? or q = db.GqlQuery("SELECT * FROM entity WHERE :1 IN ids", id) https://developers.google.com/appengine/docs/python/datastore/queries 回答1: It's just q.filter('ids', id) . 来源: https://stackoverflow.com

Nested transactions on google app engine datastore 3

丶灬走出姿态 提交于 2019-12-25 05:19:09
问题 Question is: does ds.put(employee) happen in transaction? Or does the outer transaction get erased/overriden by the transaction in saveRecord(..)? Once error is thrown at line datastore.put(..) at some point in the for-loop (let's say i==5), will previous puts originating on the same line get rollbacked? What about puts happening in the saveRecord(..). I suppose those will not get rollbacked. DatastoreService datastore = DatastoreServiceFactory.getDatastoreService() Transaction txn =

Nested transactions on google app engine datastore 3

ぃ、小莉子 提交于 2019-12-25 05:19:05
问题 Question is: does ds.put(employee) happen in transaction? Or does the outer transaction get erased/overriden by the transaction in saveRecord(..)? Once error is thrown at line datastore.put(..) at some point in the for-loop (let's say i==5), will previous puts originating on the same line get rollbacked? What about puts happening in the saveRecord(..). I suppose those will not get rollbacked. DatastoreService datastore = DatastoreServiceFactory.getDatastoreService() Transaction txn =

How to get all the kinds in the google app engine datastore?

十年热恋 提交于 2019-12-25 04:51:35
问题 I'm using java to code for GAE, I've read through the GAE Java low level API and can't find any answer to my question yet. I wanna know if there's a way where I can call a method/do a JDOPL and it returns all the different kinds of entities in my Datastore. 回答1: You could use the datastore statistics API: http://code.google.com/appengine/docs/java/datastore/stats.html It looks like the __Stat_Kind__ statistic will give you the info you want. 回答2: I found a working solution here. (it doesn't