gql

AppEngine DataStore - GQL not returning any results

不羁岁月 提交于 2019-12-24 16:25:07
问题 $query = "SELECT * FROM Name"; works perfectly as expected but: $query = "SELECT * FROM Name WHERE name = 'david'"; doesn't work as expected. The DataStore is created as follows: $obj_name = new Entity(); $obj_name->name = strtolower($name); $obj_name->age = $age; $result = $obj_name_store->upsert($obj_name); Any suggestions for how to extract a specific item using GQL? Thank you. 回答1: It looks like you are using my php-gds library from here: https://github.com/tomwalder/php-gds If so, then

ANCESTOR Query Parse Error: Using DISTINCT

∥☆過路亽.° 提交于 2019-12-24 00:16:00
问题 Not this question: Ancestor query parse error I structured it with "IS" properly: SELECT DISTINCT batch_no FROM Entry WHERE ANCESTOR IS KEY('ag1kZXZ-dHRiLXRhbWVychkLEgdCcmV3ZXJ5IgxCUi1USEVSRURQRUEM') But still I got the error: Why is that? 回答1: In this case, DISTINCT was causing the problem. Remove it and this Query functions no prob. I think it is somehow implicitly projecting, you cannot access the key, only that property you DISTINCT on; even if you use "*" Though I think it's fair to say

How can I create composite index without using GAE?

百般思念 提交于 2019-12-23 22:13:13
问题 I'm working on Google Cloud Datastore with Go SDK, and hitting a GQL query error - "Your Datastore does not have the composite index (developer-supplied) required for this query." I'm aware that I need to create the composite index. But according to Google Datastore document, it assumes that the application is up and running as an GAE, while in my case we run it on GKE and Go SDK to work with Datastore. So my question is, do I need to have an GAE instance just for creating an composite index?

App Engine Datastore IN Operator - how to use?

荒凉一梦 提交于 2019-12-23 16:27:22
问题 Reading: http://code.google.com/appengine/docs/python/datastore/gqlreference.html I want to use: := IN but am unsure how to make it work. Let's assume the following class User(db.Model): name = db.StringProperty() class UniqueListOfSavedItems(db.Model): str = db.StringPropery() datesaved = db.DateTimeProperty() class UserListOfSavedItems(db.Model): name = db.ReferenceProperty(User, collection='user') str = db.ReferenceProperty(UniqueListOfSavedItems, collection='itemlist') How can I do a

What is the Google Appengine Ndb GQL query max limit?

那年仲夏 提交于 2019-12-22 06:37:33
问题 I am looking around in order to get an answer what is the max limit of results I can have from a GQL query on Ndb on Google AppEngine. I am using an implementation with cursors but it will be much faster if I retrieve them all at once. 回答1: Basically you don't have the old limit of 1000 entities per query anymore, but consider using a reasonable limit, because you can hit the time out error and it's better to get them in batches so users won't wait during load time. 回答2: This depends on lots

Between query equivalent on App Engine datastore?

喜夏-厌秋 提交于 2019-12-21 05:10:48
问题 I have a model containing ranges of IP addresses, similar to this: class Country(db.Model): begin_ipnum = db.IntegerProperty() end_ipnum = db.IntegerProperty() On a SQL database, I would be able to find rows which contained an IP in a certain range like this: SELECT * FROM Country WHERE ipnum BETWEEN begin_ipnum AND end_ipnum or this: SELECT * FROM Country WHERE begin_ipnum < ipnum AND end_ipnum > ipnum Sadly, GQL only allows inequality filters on one property, and doesn't support the BETWEEN

Google App Engine Query (not filter) for children of an entity

天涯浪子 提交于 2019-12-20 14:20:28
问题 Are the children of an entity available in a Query? Given: class Factory(db.Model): """ Parent-kind """ name = db.StringProperty() class Product(db.Model): """ Child kind, use Product(parent=factory) to make """ @property def factory(self): return self.parent() serial = db.IntegerProperty() Assume 500 factories have made 500 products for a total of 250,000 products. Is there a way to form a resource-efficient query that will return just the 500 products made by one particular factory? The

Case insensitive where clause in gql query for StringProperty

白昼怎懂夜的黑 提交于 2019-12-17 19:35:14
问题 Using the google appengine datastore, is there a way to perform a gql query that specifies a WHERE clause on a StringProperty datatype that is case insensitive? I am not always sure what case the value will be in. The docs specify that the where is case sensitive for my values, is there a way to make this insensitive? for instance the db Model would be this: from google.appengine.ext import db class Product(db.Model): id = db.IntegerProperty() category = db.StringProperty() and the data looks

Can you get all entities of a model in appengine and not a gqlquery

大兔子大兔子 提交于 2019-12-13 18:03:30
问题 I want a list of all my model entities. Model.all() returns a gqlquery. I know that I can then do list comprehension on the query and end up with the result I am seeking. Is there not a way already built-in saving the additional step of doing the comprehension? Or is everyone just subclassing and building the method in themselves? ... or is this a safety measure preventing us from accessing more data then we intended incurring costs? Thanks 回答1: To get to the entity you need a key. If you

What Does a Blank GQL Result Look Like?

风流意气都作罢 提交于 2019-12-13 02:38:07
问题 I am working on a Google App Engine application, and have been facing some issues with a GQL query and an if statement. This is the code: q = Song.gql("WHERE title = :1", self.request.get('song_title')) q.get() if q: r = "Excisting Results Found: <br />" print q for song in q: r += song.title+" by "+song.artist+"<br />" self.response.out.write(r) else: ... When this is run, the page returns "Excisting Results Found:" however I know that no results were in fact found. Is there a way to check