google-cloud-datastore

Golang GAE - intID in struct for mustache

 ̄綄美尐妖づ 提交于 2019-12-03 14:11:17
Here is an Example of the app. The essential code is in: golang-code/handler/handler.go (After the subject should appear an ID!) Im trying to build a little blog system in Golang on Google Appengine and use Mustache as template engine. So, i have a struct: type Blogposts struct { PostTitle string PostPreview string Content string Creator string Date time.Time } The data is passed to GAE via datastore.Put(c, datastore.NewIncompleteKey(c, "Blogposts", nil), &blogposts) So, GAE assigns automatically a intID (int64). Now I tried to get the latest blogposts // Get the latest blogposts c :=

Google app engine excessive small datastore operations

情到浓时终转凉″ 提交于 2019-12-03 13:52:07
I'm having some trouble with the google app engine datastore. Ever since the new pricing model was introduced, the cost of running my app has increased massively. The culprit appears to be "Datastore small operations", which come in at more than 20 Million ops per day! Has anyone had this problem, I don't think I'm doing an excessive amount of key lookups, and I only have 5000 users, with roughly 10 - 20 requests per minute. Thanks in advance! Edit Ok got some stats, these are after abut 3 hours. Here is what I am seeing in my dashboard, in the billing section: And here are some of the stats:

Hierarchy Optimization on Google Appengine Datastore

你。 提交于 2019-12-03 13:51:18
问题 I have hierarchical data stored in the datastore using a model which looks like this: class ToolCategories(db.Model): name = db.StringProperty() parentKey = db.SelfReferenceProperty(collection_name="parent_category") ... ... I want to print all the category names preserving the hierarchy, say in some form like this : --Information Gathering ----OS Fingerprinting ----DNS ------dnstool ----Port Scanning ------windows --------nmap ----DNS3 ----wireless sniffers ------Windows --------Kismet To do

Querying for N random records on Appengine datastore

喜夏-厌秋 提交于 2019-12-03 12:37:02
问题 I'm trying to write a GQL query that returns N random records of a specific kind. My current implementation works but requires N calls to the datastore. I'd like to make it 1 call to the datastore if possible. I currently assign a random number to every kind that I put into the datastore. When I query for a random record I generate another random number and query for records > rand ORDER BY asc LIMIT 1. This works, however, it only returns 1 record so I need to do N queries. Any ideas on how

Schema-less design guidelines for Google App Engine Datastore and other NoSQL DBs

最后都变了- 提交于 2019-12-03 12:21:14
问题 Coming from a relational database background, as I'm sure many others are, I'm looking for some solid guidelines for setting up / designing my datastore on Google App Engine. Are there any good rules of thumb people have for setting up these kinds of schema-less data stores? I understand some of the basics such as denormalizing since you can't do joins, but I was wondering what other recommendations people had. The particular simple example I am working with concerns storing searches and

What is the correct way to get the previous page of results given an NDB cursor?

蹲街弑〆低调 提交于 2019-12-03 11:40:39
问题 I'm working on providing an API via GAE that will allow users to page forwards and backwards through a set of entities. I've reviewed the section about cursors on the NDB Queries documentation page, which includes some sample code that describes how to page backwards through query results, but it doesn't seem to be working as desired. I'm using GAE Development SDK 1.8.8. Here's a modified version of that example that creates 5 sample entities, gets and prints the first page, steps forward

GAE Go — How to use GetMulti with non-existent entity keys?

孤街醉人 提交于 2019-12-03 11:37:11
I've found myself needing to do a GetMulti operation with an array of keys for which some entities exist, but some do not. My current code, below, returns an error ( datastore: no such entity ). err := datastore.GetMulti(c, keys, infos) So how can I do this? I'd use a "get or insert" method, but there isn't one. GetMulti can return a appengine.MultiError in this case. Loop through that and look for datastore.ErrNoSuchEntity . For example: if err := datastore.GetMulti(c, keys, dst); err != nil { if me, ok := err.(appengine.MultiError); ok { for i, merr := range me { if merr == datastore

Improve throughput of ndb query over large data

折月煮酒 提交于 2019-12-03 10:16:28
问题 I am trying to perform some data processing in a GAE application over data that is stored in the Datastore. The bottleneck point is the throughput in which the query returns entities and I wonder how to improve the query's performance. What I do in general: everything works in a task queue, so we have plenty of time (10 minute deadline). I run a query over the ndb entities in order to select which entities need to be processed. as the query returns results, I group entities in batches of, say

Google Cloud Endpoints with Google Cloud Functions [closed]

时间秒杀一切 提交于 2019-12-03 09:43:17
Closed. This question is off-topic. It is not currently accepting answers. Learn more . Want to improve this question? Update the question so it's on-topic for Stack Overflow. I was not able to find documentation about how to connect GCF with Google Cloud Endpoints. As I understand Google Cloud Endpoints can be configured to access internal cloud resources. It is not clear how to use load balancer with Endpoints service as well. In the Building Scalable Web Apps with Cloud Datastore article it indicates that you should be able to configure a direct connection from Cloud Endpoints to Cloud

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

牧云@^-^@ 提交于 2019-12-03 09:32:51
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? 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. 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 black then view the page source. Your should see something like this (chrome - firefox - safari): <iframe style=