gqlquery

GQL query help - How can I write a query with where clause in GQL ? I am using google appengine datastore

这一生的挚爱 提交于 2020-01-24 12:02:11
问题 I have three records in a table example: *Usernames* *email* *city* Nick nick@example.com London Vikky vicky@example.com Paris Lisa lisa@example.com Sydney Now I want to get specific record keeping email ID as a key , SQL query may be like this select * from table1 where email = "vicky@example.com" What is the equivalent GQL query for the above ?? 回答1: SELECT * FROM table1 WHERE email = 'vicky@example.com' should work fine in GQL. See here for more information http://code.google.com/appengine

GQL query help - How can I write a query with where clause in GQL ? I am using google appengine datastore

回眸只為那壹抹淺笑 提交于 2020-01-24 12:02:09
问题 I have three records in a table example: *Usernames* *email* *city* Nick nick@example.com London Vikky vicky@example.com Paris Lisa lisa@example.com Sydney Now I want to get specific record keeping email ID as a key , SQL query may be like this select * from table1 where email = "vicky@example.com" What is the equivalent GQL query for the above ?? 回答1: SELECT * FROM table1 WHERE email = 'vicky@example.com' should work fine in GQL. See here for more information http://code.google.com/appengine

How to construct GQL to not contain a value from a set?

老子叫甜甜 提交于 2019-12-31 01:45:32
问题 Is it possible to select from a google app engine db where the key of a db.Model object is not in a given list? If so, what would be the syntax? Ex of a model class: class Spam(db.Model): field1 = db.BooleanProperty(default=false) field2 = db.IntegerProperty() Example of a query which I'd like to work but can't figure out: spam_results = db.GqlQuery( "SELECT * FROM Spam WHERE key NOT IN :1 LIMIT 10", ['ag1waWNreXByZXNlbnRzchMLEgxBbm5vdW5jZW1lbnQYjAEM',

Does GQL support commonly available SQL Style aggregation?

南笙酒味 提交于 2019-12-30 04:59:04
问题 What I'm looking for a simple Aggregate Functions that are widely available in versions of SQL. Simple things like Select Count(*) from table1 to the more complex. If these are available, is there some documentation you could point me to? Thanks - Giggy 回答1: The SQL aggregate functions are not available. What you want to do is follow patterns like the sharded counters example: http://code.google.com/appengine/articles/sharding_counters.html which explain that instead of aggregating the values

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

Is there OR operator in GQL?

一世执手 提交于 2019-12-12 13:53:25
问题 I don't know if this has been asked here. I saw couple of questions on "like" operator but I'm not sure if that's I'm looking for. Sorry I'm a noob at this. But I am moving from MySQL to Google App Engine and was wondering if there was an OR operator in GQL similar to ones in MySQL. Basically what I am trying to achieve is get the login on name via their username or email address. So my query would be something like this. query = db.GqlQuery("SELECT * FROM mytable where username = :name OR

Google app engine - Query only for a field

。_饼干妹妹 提交于 2019-12-08 11:09:17
问题 Note: this example is just representative of the problem, not a real use case I would like to know if I have a certain objects for example Car and CarCategory: Owner - name - age Car - name - brand - category( reference ) - owner ( reference ) CarCategory - name - property Can I query for a certain field? For example CarCategory: query = GqlQuery("SELECT category FROM Car") I'm getting this error: BadQueryError: Parse Error: Expected no additional symbols at symbol Car Update: What if want to

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

眉间皱痕 提交于 2019-12-03 03:30:39
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 ancestor method is a filter, so using e.g. Product.all().ancestor(factory_1) would require repeated calls

How to construct GQL to not contain a value from a set?

丶灬走出姿态 提交于 2019-12-01 21:55:19
Is it possible to select from a google app engine db where the key of a db.Model object is not in a given list? If so, what would be the syntax? Ex of a model class: class Spam(db.Model): field1 = db.BooleanProperty(default=false) field2 = db.IntegerProperty() Example of a query which I'd like to work but can't figure out: spam_results = db.GqlQuery( "SELECT * FROM Spam WHERE key NOT IN :1 LIMIT 10", ['ag1waWNreXByZXNlbnRzchMLEgxBbm5vdW5jZW1lbnQYjAEM', 'ag1waWNreXByZXNlbnRzchMLEgxBbm5vdW5jZW1lbnQYjgEM']) for eggs in spam_results: print "id: %s" % a.key().id() No Though app engine supports an