google-cloud-datastore

Client Library for Cloud Datastore on App Engine - NDB or google-cloud-datastore

浪尽此生 提交于 2020-01-22 12:59:05
问题 Per Google's documentation, it seems like I have two main options for connecting to Datastore using Python: App Engine's NDB Datastore library, and the Google Cloud Datastore API for Python. I'm currently on App Engine (Standard), but I'd like to structure my app such that it can grow beyond if required, likely via a move to Compute Engine. With that in mind, which library should I use? App engine's documentation states that NDB can be used, but it doesn't seem to be very actively developed

Google datastore - index a date created field without having a hotspot

一世执手 提交于 2020-01-17 06:11:45
问题 I am using Google Datastore and will need to query it to retrieve some entities. These entities will need to be sorted by newest to oldest. My first thought was to have a date_created property which contains a timestamp. I would then index this field and sort on this field. The problem with this approach is it will cause hotspots in the database (https://cloud.google.com/datastore/docs/best-practices). Do not index properties with monotonically increasing values (such as a NOW() timestamp).

unable to save data in datastore but no errors

怎甘沉沦 提交于 2020-01-17 05:38:09
问题 I'm building a web crawler. some of the the data I input into datastore get saved, others do not get saved and I have no idea what is the problem. here is my crawler class class Crawler(object): def get_page(self, url): try: req = urllib2.Request(url, headers={'User-Agent': "Magic Browser"}) # yessss!!! with the header, I am able to download pages #response = urlfetch.fetch(url, method='GET') #return response.content #except urlfetch.InvalidURLError as iu: # return iu.message response =

Projection Queries vs. Regular Queries

巧了我就是萌 提交于 2020-01-17 02:20:30
问题 Reading the documentation on Cloud Datastore, it's pretty clear that a Get retrieves the entire entity, and that a query is always done against the index. Here's where it gets confusing, because according to the documentation: Projection queries allow you to query Cloud Datastore for just those specific properties of an entity that you actually need, at lower latency and cost than retrieving the entire entity But if all queries are done against an index, a query would never retrieve the

Projection Queries vs. Regular Queries

对着背影说爱祢 提交于 2020-01-17 02:20:09
问题 Reading the documentation on Cloud Datastore, it's pretty clear that a Get retrieves the entire entity, and that a query is always done against the index. Here's where it gets confusing, because according to the documentation: Projection queries allow you to query Cloud Datastore for just those specific properties of an entity that you actually need, at lower latency and cost than retrieving the entire entity But if all queries are done against an index, a query would never retrieve the

Why properties referenced in an equality (EQUAL) or membership (IN) filter cannot be projected?

a 夏天 提交于 2020-01-16 18:52:09
问题 https://developers.google.com/appengine/docs/java/datastore/projectionqueries Why a projected query such as this : SELECT A FROM kind WHERE A = 1 not supported ? 回答1: Because it makes no sense. You are asking SELECT A FROM kind WHERE A = 1 so, give me A where A = 1 . Well, you already know that A = 1 . It makes no sense for DB to allow that. The IN query is internally just a series of equals queries merged together, so the same logic applies to it. 回答2: The reasoning behind this could be that

Putting models in a callback function from ctypes library

自作多情 提交于 2020-01-16 18:34:28
问题 I am trying to setup an application based on the Google App Engine using the Managed VM feature. I am using a shared library written in C++ using ctypes cdll.LoadLibrary('./mylib.so') which registers a callback function CB_FUNC_TYPE = CFUNCTYPE(None, eSubscriptionType) cbFuncType = CB_FUNC_TYPE(scrptCallbackHandler) in which i want to save data to the ndb datastore def scrptCallbackHandler(arg): model = Model(name=str(arg.data)) model.put() I am registering a callback function in which i want

Key Path Element Must be complete

余生长醉 提交于 2020-01-16 18:13:24
问题 I'm working through some documentation for the google cloud datastore API from google.cloud import datastore datastore_client = datastore.Client(project="PROJECTNAME") query = datastore_client.query(kind='Video') r = query.fetch() for v in r: key = datastore_client.key('VideosToCollections') entity = datastore.Entity(key=key) entity['collection_key'] = key datastore_client.put(entity) quit() However I receive this error when updating an entry Traceback (most recent call last): File

How do I send notifications from Google Cloud(GCP) via Firebase to an Android app

我只是一个虾纸丫 提交于 2020-01-16 11:26:18
问题 I know how to send messages from Firebase cloud messaging portal to an android device. But my server runs on Google Cloud, I do gcloud app deploy from my local machine and the app logic gets deployed on Google Cloud. Now, I want to send notifications, based on the data stored as Entities in GCP Datastore, to an Android App. Notification messages can be sent from Firestore-Cloud Messaging portal to an Android device, if I could harness this Firestore Cloud Messaging API in my GCP logic, then

Share a model through apps without API

冷暖自知 提交于 2020-01-16 09:15:53
问题 Is it possible to share a model through other apps? if possible, how to do this. Yeah, maybe we can implement API for those apps, But if apps can share their models for each other without any external libs, it would be cool :-) 回答1: You could possibly broaden your definition of "other applications" in the original question to include other versions of the same application (where these versions are really your "other applications"). If so, then this could be possible by deploying each of your