google-cloud-datastore

Google App Engine Datastore returns no rows if i have an Order clause

夙愿已清 提交于 2019-12-10 23:22:22
问题 I have a 'kind' in datastore like so: type CompanyDS struct { Name string } If i query it with the 'order' clause below, it returns no rows (but doesn't give any error): var companiesDS []CompanyDS datastore.NewQuery("Company").Order("Name").GetAll(c, &companiesDS) However if i remove the 'order("Name")' section it returns all the rows just fine. 回答1: Since without Order() you can query all entities, that means they do exist with name "Company" and property "Name" . Indices for single

Proper way to migrate NDB model property

情到浓时终转凉″ 提交于 2019-12-10 21:51:24
问题 I currently have a model in NDB and I'd like to change the property name without necessarily touching NBD. Let's say I have the following: from google.appengine.ext import ndb class User(ndb.Model): company = ndb.KeyProperty(repeated=True) What I would like to have is something more like this: class User(ndb.Model): company_ = ndb.KeyProperty(repeated=True) @property def company(self): return '42' @company.setter def company(self, new_company): #set company here Is there a relatively pain

Google Datastore python returning less number of entities per page

♀尐吖头ヾ 提交于 2019-12-10 20:40:33
问题 I am using Python client SDK for Datastore (google-cloud-datastore) version 1.4.0. I am trying to run a key-only query fetch: query = client.query(kind = 'SomeEntity') query.keys_only() Query filter has EQUAL condition on field1 and GREATER_THAN_OR_EQUAL condition on field2. Ordering is done based on field2 For fetch, I am specifying a limit: query_iter = query.fetch(start_cursor=cursor, limit=100) page = next(query_iter.pages) keyList = [entity.key for entity in page] nextCursor = query_iter

How to change google cloud datastore kind name ?

柔情痞子 提交于 2019-12-10 19:15:44
问题 We are using google cloud datastore to store data and unfortunately initially haven't followed name convention for naming kinds and now we want to change names of already existing kinds in datastore . We have already accumulated a lot of data and a lot of computation was involved generating that data so populating that complete data again just to rename a kind isn't an option for us. Have tried finding it out but with no luck. So is there something which I have missed and can be helpful in

How can I Export local datastore data to Production Google App Engine Datastore

荒凉一梦 提交于 2019-12-10 19:11:35
问题 I wanted to export my local datastore data to my google appengine application datastore. Is there any direct and short way to do it. 回答1: You can read about it here 来源: https://stackoverflow.com/questions/2903893/how-can-i-export-local-datastore-data-to-production-google-app-engine-datastore

How to COPY all entities in a Kind in GAE to another Kind without explicitly calling out each property

不羁岁月 提交于 2019-12-10 18:07:16
问题 How do we use function clone_entity() as described in Copy an entity in Google App Engine datastore in Python without knowing property names at 'compile' time to copy the values to an entity in a different Kind? (since the keys get copied as well so cloning happens in the same Kind so the solution at the above link does not work for this particular purpose!) Tried the following (and other variations but to no avail) query = db.GqlQuery("SELECT * FROM OrigKind") results = query.fetch(10); for

Workaround to return a list from a ComputedProperty function in NDB

元气小坏坏 提交于 2019-12-10 17:53:31
问题 I am converting my app to use NDB. I used to have something like this before: @db.ComputedProperty def someComputedProperty(self, indexed=False): if not self.someCondition: return [] src = self.someReferenceProperty list = src.list1 + src.list2 + src.list3 + src.list4 \ + [src.str1, src.str2] return map(lambda x:'' if not x else x.lower(), list) As you can see, my method of generating the list is a bit complicated, I prefer to keep it this way. But when I started converting to NDB, I just

Firebase + Datastore = need_index

末鹿安然 提交于 2019-12-10 17:47:13
问题 I'm working through the appengine+go tutorial, which connects in with Firebase: https://cloud.google.com/appengine/docs/standard/go/building-app/. The code is available at https://github.com/GoogleCloudPlatform/golang-samples/tree/master/appengine/gophers/gophers-6, which aside from my Firebase keys is identical. I have it working locally just fine under dev_appserver.py , and it queries the Vision API and adds labels. However, after I deploy to appengine I get an index error on datastore. If

Making a Google App Engine datastore key from a string

為{幸葍}努か 提交于 2019-12-10 17:29:57
问题 I'm passing an entities "id" as a string on a URL, for example: ..../foo/234565 I want to use the id in the following query: //...i hace some code that gets stringId from the URL, and I verified that it works stringId = .... theKey, err := datastore.DecodeKey(stringId) q := datastore.NewQuery("Foo").Filter("__key__ =", theKey) The error I'm getting: proto: can't skip unknown wire type 7 for datastore.Reference Is there a simple way to convert stringId into a "Key"? 回答1: c := appengine

How to manipulate files in google app engine datastore

社会主义新天地 提交于 2019-12-10 16:26:39
问题 My problem revolves around a user making a text file upload to my app. I need to get this file and process it with my app before saving it to the datastore. From the little I have read, I understand that user uploads go directly to the datastore as blobs, which is ok if I could then get that file, perform operations on it(meaning change data inside) and then re-write it back to the datastore. All these operations need to be done by the app. Unfortunately from the datastore documenation, http: