google-cloud-datastore

How can I have dynamic properties in go on the google app engine datastore

若如初见. 提交于 2020-01-10 02:15:09
问题 I want to do something like the Expando Model that python supports on app engine. Sometimes you don't want to declare your properties ahead of time. A special model subclass, Expando, changes the behavior of its entities so that any attribute assigned (as long as it doesn't start with an underscore) is saved to the Datastore. How can I do this in Go? 回答1: Note beforehand: There are 2 APIs. The one with import path appengine/datastore uses channels as arguments. The other with import path

Google App Engine - Connect to remote datastore locally using Objectify

匆匆过客 提交于 2020-01-07 05:57:09
问题 I've looked everywhere and wasted a lot of time on something that I think is probably very simple. Thanks for the help in advance. I have a google app engine app using the cloud datastore written in Java. I have an entity class as follows: @Entity public class Student { @Id private Long studentId; @Index private League league; @Index private String year; private String firstName; private String lastName; ... } I have a csv file of 1K students. I need to upload this info into the cloud

Google App Engine - Connect to remote datastore locally using Objectify

女生的网名这么多〃 提交于 2020-01-07 05:57:08
问题 I've looked everywhere and wasted a lot of time on something that I think is probably very simple. Thanks for the help in advance. I have a google app engine app using the cloud datastore written in Java. I have an entity class as follows: @Entity public class Student { @Id private Long studentId; @Index private League league; @Index private String year; private String firstName; private String lastName; ... } I have a csv file of 1K students. I need to upload this info into the cloud

Displaying uploaded file in GAE Appengine with Python

混江龙づ霸主 提交于 2020-01-07 05:45:08
问题 I have stored pdf files uploaded by users in the Datastore, as BlobProperties: <form action="/" method="post" enctype="multipart/form-data"> <input type="file" name="pdf"> <input type="submit" value="Upload"> </form> with the following handler: def post(self): p = self.request.get('pdf') if p: person.pdf = p I have also tried this version of the last line: person.pdf = db.Blob(p) which seems to work the same way. I try to display it thus: <embed src="{{ person.pdf }}" width="500" height="375"

JDO - Querying/linking child by parent (Google App Engine)?

别来无恙 提交于 2020-01-07 04:51:09
问题 I've been trying to get JDO working with parent/child relationships, but I'm not having much success. Using the relationship setup as seen here and queries as seen here, I want to be able to link a child to a parent, then be able to query for all children of a given parent. Unfortunately, I don't seem to be querying the children correctly. I keep getting the error: Class Parent for query has not been resolved. Check the query and any imports/aliases specification Here's what my code looks

Google App Engine fetch() and print

泪湿孤枕 提交于 2020-01-07 04:28:28
问题 This is the model: class Rep(db.Model): author = db.UserProperty() replist = db.ListProperty(str) unique = db.ListProperty(str) date = db.DateTimeProperty(auto_now_add=True) I am writing replist to datastore: L = [] rep = Rep() s = self.request.get('sentence') L.append(s) rep.replist = L rep.put() and retrieve mylist = rep.all().fetch(1) I assume that mylist is a list. How do I print its elements? When I try it I end up with the object; something like [<__main__.Rep object at 0x04593C30>]

Save gwt entities to google application engine datastore with jdo, using rpc

孤人 提交于 2020-01-07 04:09:10
问题 Hello iam new to GWT framework. I want to persist my domain objects/entities to google application engine datastore using rpc. A simple implementation to test if i can make multiple rpc calls ( greetServer() , saveStudent() ) Student import javax.jdo.annotations.Extension; import javax.jdo.annotations.IdGeneratorStrategy; import javax.jdo.annotations.PersistenceCapable; import javax.jdo.annotations.Persistent; import javax.jdo.annotations.PrimaryKey; import com.google.gwt.user.client.rpc

Sort Items Objectify Getting error No matching Index Found

走远了吗. 提交于 2020-01-07 02:55:08
问题 I am trying to sort a list of items by my property 'price' but I'm getting error. This is my filter items = ofy().load().type(MyItem.class) .filter("OtherEntityRef", tmpEntity) .order("price").limit(100) .list(); But we I run it, the log shows the erro: Uncaught exception from servlet java.io.IOException: com.google.appengine.repackaged.org.codehaus.jackson.map.JsonMappingException: no matching index found. The suggested index for this query is: <datastore-index kind="MyClass" ancestor="false

Objectify - many writes to same entity in short period of time with and without transaction

人走茶凉 提交于 2020-01-07 02:03:27
问题 What I'm doing is creating a transaction where 1) An entity A has a counter updated to +1 2) A new entity B is written to the datastore. It looks like this: WrappedBoolean result = ofy().transact(new Work<WrappedBoolean>() { @Override public WrappedBoolean run() { // Increment count of EntityA.numEntityBs by 1 and save it entityA.numEntityBs = entityA.numEntityBs +1; ofy().save().entity(entityA).now(); // Create a new EntityB and save it EntityB entityB = new EntityB(); ofy().save().entity

Objectify - many writes to same entity in short period of time with and without transaction

流过昼夜 提交于 2020-01-07 02:03:07
问题 What I'm doing is creating a transaction where 1) An entity A has a counter updated to +1 2) A new entity B is written to the datastore. It looks like this: WrappedBoolean result = ofy().transact(new Work<WrappedBoolean>() { @Override public WrappedBoolean run() { // Increment count of EntityA.numEntityBs by 1 and save it entityA.numEntityBs = entityA.numEntityBs +1; ofy().save().entity(entityA).now(); // Create a new EntityB and save it EntityB entityB = new EntityB(); ofy().save().entity