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
125
votes
12 answers

Google App Engine: Is it possible to do a Gql LIKE query?

Simple one really. In SQL, if I want to search a text field for a couple of characters, I can do: SELECT blah FROM blah WHERE blah LIKE '%text%' The documentation for App Engine makes no mention of how to achieve this, but surely it's a common…
littlecharva
  • 4,224
  • 8
  • 45
  • 52
75
votes
5 answers

How do I query in GQL using the entity key

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:…
Thilo
  • 257,207
  • 101
  • 511
  • 656
35
votes
5 answers

GQL query with numeric id in datastore viewer

I want to build GQL query to get an object using its numeric id. I'm doing this in Datastore viewer in App management console, so I can't use Model.get_by_id(numeric_id). Something like SELECT * FROM Model WHERE id = also doesn't work.
Pawel Markowski
  • 1,186
  • 3
  • 12
  • 21
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
28
votes
5 answers

App Engine Datastore Viewer, how to show count of records using GQL?

I would think this would be easy for an SQL-alike! What I want is the GQL equivalent of: select count(*) from foo; and to get back an answer something similar to: 1972 records. And I want to do this in GQL from the "command line" in the web-based…
Olie
  • 24,597
  • 18
  • 99
  • 131
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
9
votes
1 answer

Finding the maximum value in a column using GQL

How do I find the maximum value in a particular column of a table in the GAE datastore using GQL?
9
votes
6 answers

Querying for N random records on Appengine datastore

I'm trying to write a GQL query that returns N random records of a specific kind. My current implementation works but requires N calls to the datastore. I'd like to make it 1 call to the datastore if possible. I currently assign a random number to…
aloo
  • 5,331
  • 7
  • 55
  • 94
8
votes
3 answers

How to delete a record using GQL?

I need to iterate and delete all records of my datastore. I am using Google App engine Launcher to test it on local host. How to do it? When I am trying to delete all recors in Person model that way: qObj = Person.all() db.delete(qObj) I am…
J.Olufsen
  • 13,415
  • 44
  • 120
  • 185
8
votes
4 answers

Select columns by name rather than letter in Google Query Language (GQL) with Google Spreadsheets?

newbie question, is it possible to select columns by name rather than letter when using Google Query Language with Google Spreadsheets? This works fine for me: "SELECT A, COUNT(B) GROUP BY A" It'd be great if I could use the column headers in the…
prototype
  • 7,249
  • 15
  • 60
  • 94
8
votes
2 answers

Google app engine and paging

How would one go about writing a query that selects items 2000-2010 out of a collection of 10000 objects in the data store. I know that it can be done like this in GQL: select * from MyObject limit 10 offset 2000 According to the documentation,…
Klaus Byskov Pedersen
  • 117,245
  • 29
  • 183
  • 222
7
votes
6 answers

Google App Engine: Intro to their Data Store API for people with SQL Background?

Does anyone have any good information aside from the Google App Engine docs provided by Google that gives a good overview for people with MS SQL background to porting their knowledge and using Google App Engine Data Store API effectively. For…
TimLeung
  • 3,459
  • 6
  • 42
  • 59
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
1
2 3
35 36