Questions tagged [gql]

GQL is a SQL-like language for retrieving entities or keys from Google Cloud Datastore.

GQL is a SQL-like language for retrieving entities or keys from the . While GQL's features are different from those of a query language for a traditional relational database, the GQL syntax is similar to that of SQL.

Resources

537 questions
7
votes
6 answers

What's your experience developing on Google App Engine?

Is GQL easy to learn for someone who knows SQL? How is Django/Python? Does App Engine really make scaling easy? Is there any built-in protection against "GQL Injections"? And so on... I'd love to hear the not-so-obvious ups and downs of using…
MrDatabase
  • 43,245
  • 41
  • 111
  • 153
7
votes
1 answer

How to find entries which has not empty StringListProperty?

I have a following model in the Google appengine app. class TestModel(db.Model): names = db.StringListProperty(required=False) So, I want to get entries which has not empty in names property. I tried like this. TestModel.all().filter('names !=',…
Nyambaa
  • 38,988
  • 9
  • 29
  • 35
7
votes
2 answers

Issues with GQL query, Google Datastore. Error with multiple conditions and greater than and less than operators

I am trying to query the Datastore, and my query looks like this: SELECT * FROM mydb WHERE Latitude = "18.1" AND Number > "1" It doesn't work though. I get this error in the Datastore query box: GQL query error: Your Datastore does not have the…
7
votes
2 answers

How to store and search GeoData in AppEngine?

In my application, I want to store geographical data (longitude and latitude). Then I want to ask "which place is in this region". SQL-like query can't be used, since "Inequality Filters Are Allowed On One Property Only" in GQL link text Do you know…
Ondra
  • 3,100
  • 5
  • 37
  • 44
7
votes
4 answers

Python: DISTINCT on GQuery result set (GQL, GAE)

Imagine you got an entity in the Google App Engine datastore, storing links for anonymous users. You would like to perform the following SQL query, which is not supported: SELECT DISTINCT user_hash FROM links Instead you could use: user =…
Federico Elles
  • 891
  • 3
  • 14
  • 24
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
7
votes
4 answers

How do I query for entities that are "nearby" with the GeoPt property in Google App Engine?

How should I create a GQL query that returns the nearest entities (from my current location) based on their GeoPt property? Should I just created a 'distance' function that calculates for a set of entities with a reasonably close distance? Thanks…
ehfeng
  • 3,807
  • 4
  • 33
  • 42
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
6
votes
2 answers

Minimize subqueries with IN queries on AppEngine (python)

Is there any clever way to avoid making a costly query with an IN clause in cases like the following one? I'm using Google App Engine to build a Facebook application and at some point I (obviously) need to query the datastore to get all the entities…
abahgat
  • 13,360
  • 9
  • 35
  • 42
6
votes
2 answers

Google app engine How to count SUM from datestore?

Im wondering, how can i get a SUM of a rating entity i get from the datastore (python)? should i: ratingsum = 0 for rating in ratings: ratingsum + rating print ratingsum ?
Alon
  • 63
  • 1
  • 3
6
votes
3 answers

pass a string variable into a gql query

How in the world do I pass a string variable into GQL with python?? I can do it fine in SQL but it just isn't working. here is what I have: personalposts = db.GqlQuery("select * from PersonalPost where user_id = %s order by created desc limit 30"…
clifgray
  • 4,313
  • 11
  • 67
  • 116
5
votes
2 answers

Build a GQL query (for Google App Engine) that has a condition on ReferenceProperty

Say I have the following model: class Schedule(db.Model): tripCode = db.StringProperty(required=True) station = db.ReferenceProperty(Station, required=True) arrivalTime = db.TimeProperty(required=True) departureTime =…
Ryan Delucchi
  • 7,718
  • 13
  • 48
  • 60
5
votes
3 answers

How to insert a record using the Admin console Datastore Viewer using GQL

Is it possible to INSERT or UPDATE a entity in the datastore using the Admin > Datastore Viewer. E.g. executing something like INSERT INTO table VALUES (Foo='Bar')
Ryan
  • 23,871
  • 24
  • 86
  • 132
5
votes
2 answers

GQL Query with __key__ in List of KEYs

In the GQL reference, it is encouraged to use the IN keyword with a list of values, and to construct a Key from hand the GQL query SELECT * FROM MyModel WHERE __key__ = KEY('MyModel', 'my_model_key') will succeed. However, using the code you would…
bossylobster
  • 9,993
  • 1
  • 42
  • 61
5
votes
3 answers

Rounding in Google Query Language

I'd like to implement a series of queries with rounding in Google Query Language, such as: select round(age,-1), count(id) group by round(age,-1) or any combination of int/floor/etc. select int(age/10)*10, count(id) group by int(age/10)*10 Is…
prototype
  • 7,249
  • 15
  • 60
  • 94
1
2
3
35 36