google-cloud-datastore

Google Cloud Functions Environment Variables

断了今生、忘了曾经 提交于 2019-11-30 06:50:31
Is it possible to set environment variables for GCF so that all that settings would be visible to all functions? Or maybe there are some options to configure it in project's scope? I'm just need a mechanism to parametrize all environments, like local-dev, dev, stage, prod for functions. For now I'm trying setup local datastore emulator and setup local development/debugging/testing workflow without writing if statements inside code. As I found such things can be configured through env. veriables, but I'm don't know how it would work on target platform in cloud. In future staging will be made by

What is the python for Java's BigDecimal?

安稳与你 提交于 2019-11-30 05:01:48
In Java, when we program money it is recommended to use the class BigDecimal for money. Is there something similar in python? I would like something object-oriented that can have a currency and an exchange rate, has that been done? I store money as integers of cents (I think) and multiply with 100 to get dollars but I also have foreign currency so listing listing ordered by price becomes inconvenient when articles have different currencies and even are listed as price per hour or per item. So ideally I would like a class for money in python that has exchange rate, currency and what type of

How do I completely delete Cloud Datastore from a project?

南笙酒味 提交于 2019-11-30 04:54:45
问题 I want to create a Firestore in Native mode in an existing project. I don't have any data in Cloud Datastore, but it blocks me, saying This project uses another database service Your current project is set up to use Cloud Datastore or Cloud Firestore in Datastore mode. You can access data for this project from the Cloud Datastore console. when going through https://console.cloud.google.com/firestore/ and Cannot enable Firestore for this project Currently Firestore cannot be enabled in

gae datastore backup

我是研究僧i 提交于 2019-11-30 04:02:12
Is it necessary to do backups of gae's datastore? Does anyone have any experience, suggestions, tricks for doing so? You can now use the managed export and import feature, which can be accessed through gcloud or the Datastore Admin API: Exporting and Importing Entities Scheduling an Export Backups are always necessary to protect against human error. Since App Engine encourages you to build mutiple revisions of your code that run against the same dataset, it's important to be able to go back. A simple dump/restore tool is explained in the Bulkloader documentation . Something else I've done in

Filtering by entity key name in Google App Engine on Python

一笑奈何 提交于 2019-11-30 03:37:29
On Google App Engine to query the data store with Python, one can use GQL or Entity.all() and then filter it. So for example these are equivalent gql = "SELECT * FROM User WHERE age >= 18" db.GqlQuery(gql) and query = User.all() query.filter("age >=", 18) Now, it's also possible to query things by key name. I know that in GQL you do it like this gql = "SELECT * FROM User WHERE __key__ >= Key('User', 'abc')" db.GqlQuery(gql) But how would you now use filter to do the same? query = User.all() query.filter("__key__ >=", ?????) from google.appengine.api.datastore import Key query.filter("__key__ >

Appengine Search API vs Datastore

你离开我真会死。 提交于 2019-11-30 03:04:34
I am trying to decide whether I should use App-engine Search API or Datastore for an App-engine Connected Android Project. The only distinction that the google documentation makes is ... an index search can find no more than 10,000 matching documents. The App Engine Datastore may be more appropriate for applications that need to retrieve very large result sets. Given that I am already very familiar with the Datastore: Will someone please help me, assuming I don't need 10,000 results? Are there any advantages to using the Search API versus using Datastore for my queries (per the quote above, it

Why required and default are mutally exclusive in ndb?

旧城冷巷雨未停 提交于 2019-11-30 03:03:01
问题 In old google appengine datastore API "required" and "default" could be used together for property definitions. Using ndb I get a ValueError: repeated, required and default are mutally exclusive. Sample code: from google.appengine.ext import ndb from google.appengine.ext import db class NdbCounter(ndb.Model): # raises ValueError count = ndb.IntegerProperty(required=True, default=1) class DbCounter(db.Model): # Doesn't raise ValueError count = db.IntegerProperty(required=True, default=1) I

Using less datastore small operations in appengine

丶灬走出姿态 提交于 2019-11-30 00:07:58
问题 I'm putting together a basic photoalbum on appengine using python 27. I have written the following method to retrieve image details from the datastore matching a particular "adventure". I'm using limits and offsets for pagination, however it is very inefficient. After browsing 5 pages (of 5 photos per page) I've already used 16% of my Datastore Small Operations. Interestingly I've only used 1% of my datastore read operations. How can I make this more efficient for datastore small operations -

How to filter datastore data before mapping to cloud storage using the MapReduce API?

杀马特。学长 韩版系。学妹 提交于 2019-11-29 23:51:43
问题 Regarding the code lab here, how can we filter datastore data within the mapreduce jobs rather than fetching all objects for a certain entity kind? In the mapper pipeline definition below, the only one input reader parameter is the entity kind to process and I can't see other parameters of type filter in the InputReader class that could help. output = yield mapreduce_pipeline.MapperPipeline( "Datastore Mapper %s" % entity_type, "main.datastore_map", "mapreduce.input_readers

Please help me understand entity hierarchies in GAE's Datastore

我只是一个虾纸丫 提交于 2019-11-29 22:31:32
问题 The Google App Engine Datastore allows each entity to have a parent entity , essentially a way to form an entity hierarchy . For example, an Employee can be addressed as: Company#521/Department#5/Employee#3 The entity id is only unique among entities with the same parent, so the full entity path is required to uniquely address it. So far, so good. But when should I model a parent-child relationship this way, rather than relying on a basic reference property within an entity, as I would in a