google-cloud-datastore

ndb verify entity uniqueness in transaction

隐身守侯 提交于 2020-01-25 18:43:54
问题 I've been trying to create entities with a property which should be unique or None something similar to: class Thing(ndb.Model): something = ndb.StringProperty() unique_value = ndb.StringProperty() Since ndb has no way to specify that a property should be unique it is only natural that I do this manually like this: def validate_unique(the_thing): if the_thing.unique_value and Thing.query(Thing.unique_value == the_thing.unique_value).get(): raise NotUniqueException This works like a charm

JDO transactions + many GAE instances = overriding data

守給你的承諾、 提交于 2020-01-25 15:48:55
问题 I have very simple PersistenceCapable class: import javax.jdo.annotations.IdGeneratorStrategy; import javax.jdo.annotations.PersistenceCapable; import javax.jdo.annotations.Persistent; import javax.jdo.annotations.PrimaryKey; @PersistenceCapable public class TheEntity { @PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) private Long id; public Long getId() { return id; } @Persistent private int version; public int getVersion() { return version; } public void setVersion(int

Store images in datastore of GAE python while deploying web2py app

允我心安 提交于 2020-01-25 10:38:07
问题 I am trying to deploy a web2py application on GAE. When run locally, a phone_details table is defined in db.py using this line db.define_table('phone_details',Field('image',type='upload'),Field('name',unique=True),Field('screensiz'),Field('primcam'),Field('processor'),Field('ram'),Field('rom'),Field('os'),Field('company'),Field('price','integer')) To make it run on GAE, I created an entity in cloud datastore naming it 'phone_details' but there only string,boolean,number etc. are allowed

Firestore in Datastore mode: index hotspots for enum property values vs. just poor indices?

自古美人都是妖i 提交于 2020-01-25 08:07:11
问题 I'm experiencing symptoms which suggest that Cloud Firestore in Datastore mode can be slow when querying for properties that are shared by many other entities. It seems this may be related to an inefficient index-less query (e.g. I need a composite index for this search), or an index hotspot (though I can only find documentation recommending against monotonically increasing values, not a small number of enum values). My situation (simplified) is as follows: I have 1M entities written to a

Accessing Google App Engine's Search API from PHP

元气小坏坏 提交于 2020-01-24 18:50:48
问题 Is there anyway to do this? I've looked in the google-api-php-client library but it's not there yet. Is there any other way or am I out of luck? 回答1: The search API is only enabled for Python Java and Go, as Mario pointed out. I would look into the modules documentation and try to separate your logic. Your search API can be the only module that isn't in PHP. There is no other solution for your problem unfortunately. 回答2: The team promised that a REST API would be made available at Google I/O

How to retrieve Google Appengine Objects by id (Long value)?

夙愿已清 提交于 2020-01-24 11:06:27
问题 i have declared an entity the following way: public class MyEntity { @PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) private Long id; @Persistent private String text; //getters and setters } Now I want to retrieve the objects using the id. I tried to manage it from the Google Appengine Data Viewer with "SELECT * FROM MyEntity Where id = 382005" or via a query in a servlet. I get no results returned. But i know for sure that the object with the id exists (i made a jsp

How to retrieve Google Appengine Objects by id (Long value)?

拜拜、爱过 提交于 2020-01-24 11:06:07
问题 i have declared an entity the following way: public class MyEntity { @PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) private Long id; @Persistent private String text; //getters and setters } Now I want to retrieve the objects using the id. I tried to manage it from the Google Appengine Data Viewer with "SELECT * FROM MyEntity Where id = 382005" or via a query in a servlet. I get no results returned. But i know for sure that the object with the id exists (i made a jsp

Google App Engine JDO 3

混江龙づ霸主 提交于 2020-01-24 02:52:31
问题 Google just came out with JDO 3.0 (which uses DataNucleus 2.0) for Google App Engine, and I want to use it, since it conveniently supports unowned relationships. I've been trying for days, but I can't figure out how to use it with the Google Eclipse plugin. I've found this web page https://developers.google.com/appengine/docs/java/datastore/jdo/overview-dn2, but my project folder doesn't have a build.xml file. I tried creating a separate project and transferring all my code, but the new

Google App Engine JDO 3

馋奶兔 提交于 2020-01-24 02:52:09
问题 Google just came out with JDO 3.0 (which uses DataNucleus 2.0) for Google App Engine, and I want to use it, since it conveniently supports unowned relationships. I've been trying for days, but I can't figure out how to use it with the Google Eclipse plugin. I've found this web page https://developers.google.com/appengine/docs/java/datastore/jdo/overview-dn2, but my project folder doesn't have a build.xml file. I tried creating a separate project and transferring all my code, but the new

The Datastore Admin page is blank in my App Engine Control panel

十年热恋 提交于 2020-01-22 13:10:06
问题 The Datastore Admin page is blank in all my apps on appspot.com, I have followed the instructions to enable them, and receive no error message, just a blank page load. Can anyone help? 回答1: If you are on Google Chrome and logged in via multiple gmail accounts, try to open up App Engine dashboard using an incognito window. That should solve it. 回答2: For future users with same blank page problem and Federated login you can also try the following. Try to open the Datastore Admin page and if it's