google-cloud-datastore

How to order by the field stored in the separate model?

萝らか妹 提交于 2019-12-12 05:39:41
问题 Here is simplified version of my datastore structure: class News(db.Model): title = db.StringProperty() class NewsRating(db.Model): user = db.IntegerProperty() rating = db.IntegerProperty() news = db.ReferenceProperty(News) Now I need to display all news sorted by their total rating (sum of different users ratings). How can I do that in the following code: news = News.all() # filter by additional parms # news.filter("city =", "1") news.order("-added") # ? for one_news in news: self.response

Is an App Engine instance required for accessing Datastore?

早过忘川 提交于 2019-12-12 05:36:57
问题 Do I need to deploy an App (even a dummy one) on the App Engine in order to use the Datastore service using the google-cloud-datastore Java API from a client such as a Compute Engine running in the google cloud? 回答1: No, you don't need to deploy an AppEngine app to access the Google Cloud Datastore. You just need to create a project from the Console and you can connect to the Datastore in the project from anywhere using the google-cloud-datasource API. 来源: https://stackoverflow.com/questions

Using get_serving_url() for a image stored as blob property in datastore

二次信任 提交于 2019-12-12 05:26:58
问题 I have a datastore storing images as a blob property. I want to use get_serving_url to serve images on the fly. def urlserve(self): return images.get_serving_url(str(self.key.urlsafe()),350) It gives me a URL like http://localhost:8097/_ah/img/ahBkZXZ-cmFqaW5pbmF0aW9uciYLEglpbWFnZWxpc3QiDWRlZmF1bHRfaW1hZ2UMCxIDSW1nGKkHDA=s350 But I can't able to serve using that page. So I could only use blobstore image to do this, if so do i need to create a blobstore for my image and store the

datastore: deleting entities outside transactions

筅森魡賤 提交于 2019-12-12 05:26:41
问题 I'm unable to find documentation that fully explains entities being deleted from datastore (I'm using JDO deletePersistent) without being in a transaction. I can afford loosing data accuracy during parallel updates when not using transaction for the sake of performance and avoiding contention. But how can i make sure when my code is running on different machines at the same time that a delete operation would not be overridden by a later update / put on a previous read to that entity on

Are there any Performance SLA for Google Cloud Datastore?

久未见 提交于 2019-12-12 05:19:27
问题 I want to know the performance related data of Google Cloud Datastore like QPS and maximum throughput related data. Any information regarding these and factors which these details depends on is also preferred. 回答1: No, there is not a performance SLA for Cloud Datastore, only an availability SLA. It is unlikely that QPS would be an issue for you as I'd be almost certain there are larger QPS, higher throughput projects using it than you are likely to have. A correctly designed system can run

All Requests return 403 Unauthorized

▼魔方 西西 提交于 2019-12-12 04:48:00
问题 I'm trying to work with the cloud datatstore - I've created an appengine project, which is viewable at https://cloud.google.com/console#/. Through the cloud console, I've navigated to APIs, and turned off and back on the datastore API. I've then registered an app (web application, generic) and generated a certificate. I've ensured that the email generated from that is in the 'Teams' list with 'Can Edit' permission. After all this, any requests I generate are returning 403. Requests to other

How to set your key for GAE Datastore?

一世执手 提交于 2019-12-12 04:34:13
问题 Anyone have an idea why I keep getting this error when I make a GET request to /display-message ? { Error: Key path element must not be incomplete: [created_timestamp: ] . Am I not setting my key the right way? You can view the backend here https://jarvis-hd-live-151521.appspot-preview.com/display-message?last_updated=0 const key = datastore.key('created_timestamp', 5689413791121408); app.post('/message', function (request, response) { let message = request.body.Body; response.send("<Response

Google datastore backup to local dev_appserver

不打扰是莪最后的温柔 提交于 2019-12-12 04:27:11
问题 I'm trying to follow those instructions: https://gist.github.com/jehna/3b258f5287fcc181aacf I've downloaded my backup, made the script go to the path but it seems like the code won't get into the loop "for record in reader:" on windows. I read about it and from my impression it has to do with to format of the file (leveldb) which is not supported in windows that good. Do you have any insights/solutions about that? Thanks 回答1: This code work on windows when chaging file openning permissions

Entity Kind quota limit in App Engine?

江枫思渺然 提交于 2019-12-12 04:13:47
问题 Is there any limit on the number of Entity Kinds you can have in App Engine? The low level datastore ShardedCounter.java example creates a new Entity Kind for each counter name whereas the JDO example stores each counter in the same Entity Kind. I like the advantage of the former, but don't know whether it scales to millions of counter names? 回答1: The datastore basically works as giant HashMap<Key-Entity> , as the HashMap you can put unlimited numbers of key, since one key is a mix of your

How to avoid returning of None values with GAE NDB?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-12 04:08:36
问题 I have complex NDB query like below: employees = Employee.query(query.OR(Employee.passport_id == passport_id, Employee.inn == inn, query.AND(Employee.last_name == last_name, Employee.region == region, Employee.prof_area == prof_area), query.AND(Employee.last_name == last_name, Employee.first_name == first_name, Employee.date_of_birth == date_of_birth) )) Currently when database value is None and my value is None , such entity is returned. How can I avoid that? I think I can do something like