Questions tagged [gqlquery]
129 questions
30
votes
9 answers
What's the best way to count results in GQL?
I figure one way to do a count is like this:
foo = db.GqlQuery("SELECT * FROM bar WHERE baz = 'baz')
my_count = foo.count()
What I don't like is my count will be limited to 1000 max and my query will probably be slow. Anyone out there with a…

barneytron
- 7,943
- 3
- 23
- 25
14
votes
2 answers
How to query all entries from past 6 hours ( datetime) in GQL?
I have a simple table in Google App Engine with a date field. I want to query all the rows with the date field valued between now and 6 hours ago. How do I form this query?

erotsppa
- 14,248
- 33
- 123
- 181
12
votes
3 answers
Case insensitive where clause in gql query for StringProperty
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…

jasonmw
- 1,138
- 9
- 20
10
votes
2 answers
How to implement internet high scores in Google App Engine
I want to implement internet high scores for my game. And give feedback to players which place they have (not only top100 or something like that).
In normal SQL it would look like that:
SELECT COUNT(*) FROM Scores WHERE points > :newUsersPoints
and…

Przemyslaw Zych
- 2,000
- 1
- 21
- 24
7
votes
2 answers
Does GQL support commonly available SQL Style aggregation?
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
- 526
- 4
- 8
7
votes
1 answer
Google App Engine - Querying for arrays containing a value
I have a GAE Datastore table with an array field in it (containing a few strings).
I would like to filter this table, based on all array fields that contain a specific string.
How can i do that ?
I didn't see a 'contains' operator in GQL, and the…

Baruch Oxman
- 1,616
- 14
- 24
6
votes
1 answer
Google App Engine Query (not filter) for children of an entity
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…

Thomas L Holaday
- 13,614
- 6
- 40
- 51
5
votes
1 answer
App Engine's filter vs. gql methods
I have a user in my system who has created an entity which I'd like to retrieve. I'm attempting to do this using a filter because it's supposed to be faster than a call to the gql method. However, the filter returns no results and gql works.…

Matt Norris
- 8,596
- 14
- 59
- 90
4
votes
1 answer
Can a GQL query execute an order by over two or more kinds?
I have two entity kinds in my python GAE app - both with similar attributes - and I'd like to query both lists and order the result according to an attribute common to both kinds. So something along the lines of:
db.GqlQuery("SELECT * FROM Video1,…

citronic
- 9,868
- 14
- 51
- 74
4
votes
1 answer
Is there OR operator in GQL?
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…

shriek
- 5,605
- 8
- 46
- 75
3
votes
3 answers
How to GROUP BY in App Engine
Is there some way to GROUP BY in App Engine, via GQL or Query methods?
I made some research and I've read that there isn't GROUP BY in GQL, and looks like there isn't also in Query class.
If is there any resource or any approach to implement with…

rogcg
- 10,451
- 20
- 91
- 133
3
votes
1 answer
Why does this Gql Query return None? (Using Python and App Engine)
I am creating a number guessing game to help myself learn how to use Google's App Engine. I store the current answer as a random number in the datastore. Each time the user guesses I want to pull the answer out in a GqlQuery and compare to the users…

stairsflowers
- 33
- 2
3
votes
2 answers
Working with columns having dot(.) in their name using GQL
I use Objectify for datastore operations in my GAE/Java application. I have used Objectify's @Embeded facility in a couple of places in my project. Objectify automatically flattens the nested objects within the entity marked by @Embeded notation…

Ashwin Prabhu
- 9,285
- 5
- 49
- 82
3
votes
1 answer
Google Cloud Datastore: how to query all distinct Parent/Ancestor?
I have a Datastore Kind named Order, which has an ancestor/parent User.
I'd like to query all distinct ancestors (users) of the orders using GQL, but the following query doesn't work.
SELECT DISTINCT User FROM Order
The query's response is:
No…

Jianxin Gao
- 2,717
- 2
- 19
- 32
3
votes
4 answers
How can I filter by key, or keys, a query in Python for Google App Engine?
I have a query and I can apply filters on them without any problem. This works fine:
query.filter('foo =', 'bar')
But what if I want to filter my query by key or a list of keys?
I have them as Key() property or as a string and by trying something…

Lipis
- 21,388
- 20
- 94
- 121