google-cloud-datastore

Store image to Blobstore from android client and retrieve blobkey and upload url to store in Datastore. - GAE

瘦欲@ 提交于 2019-12-17 18:40:36
问题 In my Android application, I want to upload image to the Blobstore, then retrieve an Upload url and the image's Blobkey, so I can store the Blobkey in the DataStore. I've tried this code, but my image isn't uploading: Servlet (Return upload url) BlobstoreService blobstoreService = BlobstoreServiceFactory .getBlobstoreService(); public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { UploadOptions uploadOptions = UploadOptions.Builder

Can I use AllocateIDs as “string” ? datastore

人走茶凉 提交于 2019-12-17 16:54:28
问题 I need to assign a unique identifier to each entity in datastore. I've found AllocateIDs but the issue is that it generates integers and I use strings for the keys. Is it safe to convert the integer to a string or there is a risk of collision (i.e. datastore to return me the same integer that I'm currently using as a string key). ? 回答1: Let's clear some things first: The identifier part of an entity's key can either be a key name string or an integer numeric ID But not both. So when you save

Google Cloud DataStore automatic indexing

≡放荡痞女 提交于 2019-12-17 06:18:14
问题 I'm working on a project with already deployed indexing to google cloud datastore. We are missing index.yaml, is it possible to recreate index.yaml automatically? 回答1: You can view the deployed version of the index.yaml if it was uploaded together with your (standard environment) application code, typically with the default service/module. There is a Diagnose column in the table on the developer console's Versions page and a Tools drop-down menu for each service version row, with a Source

How to fetch more than 1000?

回眸只為那壹抹淺笑 提交于 2019-12-17 05:40:26
问题 How can I fetch more than 1000 record from data store and put all in one single list to pass to django? 回答1: Starting with Version 1.3.6 (released Aug-17-2010) you CAN From the changelog: Results of datastore count() queries and offsets for all datastore queries are no longer capped at 1000 . 回答2: Just for the record - fetch limit of 1000 entries is now gone: http://googleappengine.blogspot.com/2010/02/app-engine-sdk-131-including-major.html Quotation: No more 1000 result limit - That's right

How to fetch more than 1000?

此生再无相见时 提交于 2019-12-17 05:40:21
问题 How can I fetch more than 1000 record from data store and put all in one single list to pass to django? 回答1: Starting with Version 1.3.6 (released Aug-17-2010) you CAN From the changelog: Results of datastore count() queries and offsets for all datastore queries are no longer capped at 1000 . 回答2: Just for the record - fetch limit of 1000 entries is now gone: http://googleappengine.blogspot.com/2010/02/app-engine-sdk-131-including-major.html Quotation: No more 1000 result limit - That's right

Can a two Entities of the same Kind have the same ID if the parent is different?

天大地大妈咪最大 提交于 2019-12-14 04:09:04
问题 I know that datastore will auto generate a unique ID for root Entities. But what about Entities of the same Kind that have different Parents? Will datastore auto generate unique IDs for Entities for the same Kind with different parents (of same Kind)? e.g. User->Post . Could two different Users conceivably each have a Post with the same ID? 回答1: I wrote a JUnit test for you. It uses lombok, but you can write out the getters and setters as well. import com.google.appengine.tools.development

Google app engine development server throws the following error whenever i try to run it

南笙酒味 提交于 2019-12-14 03:58:29
问题 I'm trying to create a webservice using webapp2 and datastore in python. But whenever i try to run "dev_appserver.py app.yaml" it throws me the following error ERROR 2017-10-11 05:44:16,207 instance.py:280] Cannot connect to the instance on localhost:17514 But when i ran the same program using mac it working perfectly fine. Is I'm missing something here, Please find the screeenshot of components i have installed in gcloud. Could somebody tell what i'm doing wrong here? I'm newbie to google

App Engine BadValueError when saving ndb LocalStructured entity

泪湿孤枕 提交于 2019-12-14 03:54:13
问题 I have the models class Foo(ndb.Model): x = ndb.IntegerProperty() class Bar(ndb.Model): foo = ndb.StructuredProperty(Foo, repeated=True) I keep getting lately, when trying to save Bar entities, only in production, this error: BadValueError: Expected Foo instance, got Foo(x=100) I remember seeing this error a while ago, and then it dissapeared. What's the reason for this? 回答1: The problem was I was using relative imports for models.py in the file where I was saving the model, so somehow python

get_by_id() will not return model instance

半世苍凉 提交于 2019-12-14 03:49:35
问题 I have a Model called Version that looks like this: from google.appengine.ext import db import piece class Version(db.Model): "A particular version of a piece of writing." parent_piece = db.ReferenceProperty(piece.Piece, collection_name='versions') "The Piece to which this version belongs." note = db.TextProperty() "A note from the Author about this version." content = db.TextProperty() "The actual content of this version of the Piece." published_on = db.DateProperty(auto_now_add=True) "The

Datastore queries in Dataflow DoFn slow down pipeline when run in the cloud

余生颓废 提交于 2019-12-14 03:42:31
问题 I am trying to enhance data in a pipeline by querying Datastore in a DoFn step. A field from an object from the Class CustomClass is used to do a query against a Datastore table and the returned values are used to enhance the object. The code looks like this: public class EnhanceWithDataStore extends DoFn<CustomClass, CustomClass> { private static Datastore datastore = DatastoreOptions.defaultInstance().service(); private static KeyFactory articleKeyFactory = datastore.newKeyFactory().kind(