google-cloud-datastore

How do I query in GQL using the entity key

大兔子大兔子 提交于 2019-12-02 14:02:46
How do I write a query against the entity key using GQL in the Google App Engine Data Viewer ? In the viewer, the first column (Id/Name) displays as name=_1 , in the detail view it shows the key as Decoded entity key: Programme: name=_1 Entity key: agtzcG9................... This query does not work: SELECT * FROM Programme where name = '_1' Adam Crossland You can use the entity's key to retrieve it: SELECT * FROM Programme where __key__ = KEY('agtzcG9...................') And, you should be able to query using the name similarly: SELECT * FROM Programme where __key__ = KEY(Programme, '_1')

Parse Error: Invalid WHERE Identifier at symbol (

我与影子孤独终老i 提交于 2019-12-02 13:40:31
I am trying to get a result using an optional parameters. result = Tester.gql("WHERE (first_name IS NULL OR first_name = :first_name)" "AND (last_name IS NULL OR last_name = :last_name)" "AND (birth_date IS NULL OR birth_date = :birth_date)" "AND (test_voucher IS NULL OR test_voucher = :test_voucher)", first_name=first_name, last_name=last_name, birth_date=birth_date, test_voucher=test_voucher) However, I am getting an error about parsing when I use this GQL script. { "error": { "message": "Parse Error: Invalid WHERE Identifier at symbol (" } } I am trying to figure out what is wrong in my GQL

Availability date range queries in app engine datastore?

不打扰是莪最后的温柔 提交于 2019-12-02 13:08:48
I've looked through a bunch of other threads on this topic, and so far I haven't found any satisfactory answers, so I wanted to double check if it's really just not feasible with the datastore. In the datastore I have a set of entities that can be booked for particular time periods, and thus they have availability ranges attached to them. An AvailabilityRange entity has a start and end date, and I want to find all the AvailabilityRanges that completely encompass a desired date range. In SQL the where clause would look something like: WHERE AvailRange.startDate < :desiredStartDate AND

how to apply date filter on ancestor query

匆匆过客 提交于 2019-12-02 12:11:37
I have two entity model Student and attendance such that each attendance entity has associated student parent. Attendance model: @Entity public class Attendance { @Id Long id; @Index Date date; @Parent @Index @ApiResourceProperty(ignored = AnnotationBoolean.TRUE) Ref<Student> studentRef; public Long getId() { return id; } public Date getDate() { return date; } public void setDate(Date date) { this.date = date; } public String getWebsafeKey() { return Key.create(studentRef.getKey(), Attendance.class, id).getString(); } } Student model: @Entity public class Student { @Id Long id; @Index String

Objectify query filter by List of keys that have a parent

旧城冷巷雨未停 提交于 2019-12-02 11:52:50
I would like to create an Api method via Google App Engine (Objectify) that returns a CollectionResponse of the posts of the people that I am following, sorted by date descending. I have an Entity Post and Entity Profile both of which have Long id as their key. The Post Entity has the following property specifying it has a Parent: @Parent private Key<Profile> profileKey; The Profile Entity has the following property storing a List of id 's of the people the profile is following: // Ids of the profiles this person follows private List<Long> following = new ArrayList<>(0); I was thinking then, I

How to make the argument to filter() a variable?

浪尽此生 提交于 2019-12-02 11:45:00
I have this model class Item(db.Model): ... glam = db.StringProperty() casual = db.StringProperty() speaking = db.StringProperty() and this handler with a form with radio buttons: class SortForm(webapp.RequestHandler): def get(self): self.response.out.write(""" <form name="submit_form" action="/sortformhandler" method="post"> Category: <input type="radio" name="image" value="image"> Image <br /> Sorty by tag: <br /> <input type="radio" name="tag" value="glam" /> Glam <br /> <input type="radio" name="tag" value="formal" /> Formal <br /> <input type="radio" name="tag" value="speaking" />

GAE NDB install deployed

一笑奈何 提交于 2019-12-02 10:26:04
My Google App Engine app uses Datastore NDB. So I am importing: from google.appengine.ext import ndb but when I deploy and go to my app there is an error: ModuleNotFoundError: No module named 'google.appengine' so how do I get GAE to install this part of the Google Cloud SDK? Dustin Ingram You didn't say which runtime you're trying to deploy to (Python 2.7 or 3.7) but I'm guessing it's 3.7. The google.appengine module is only available in the first-generation Python 2.7 runtime. If you need to use it, you will need to deploy your app to this runtime. From Using the ndb client library : The ndb

Deleted Datastore entries reappear

点点圈 提交于 2019-12-02 10:22:04
问题 I'd like to re-open Deleted Datastore entries reappear as a registered user. Can the old question be deleted? I'll try to be more specific this time. I'm experiencing the following problem: Initially I put N entities of the same kind into the Datastore like that: datastore_entity = MyModel(model_property=property_value) datastore_entity.put() Afterwards I delete them. I have used the Datastore Admin interface as well as a self-defined handler for the mapreduce library in order to do so. The

app engine datastore transaction exception

橙三吉。 提交于 2019-12-02 10:06:15
In app engine transactions documentation I have found the following note: Note: If your app receives an exception when submitting a transaction, it does not always mean that the transaction failed. You can receive Timeout, TransactionFailedError, or InternalError exceptions in cases where transactions have been committed and eventually will be applied successfully. Whenever possible, make your Datastore transactions idempotent so that if you repeat a transaction, the end result will be the same. This is quite general information and I wasn't able to find more details. I have the following

Where can I download offline documentation for google cloud datastore?

喜欢而已 提交于 2019-12-02 10:00:01
Is there a better way to download the google cloud datastore docs for offline viewing than to use a web crawler? I have not found anything yet! Thanks! Sorry but we don't currently support this for any of the documentation hosted on developers.google.com. 来源: https://stackoverflow.com/questions/16730698/where-can-i-download-offline-documentation-for-google-cloud-datastore