Hi,
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 enough problem?
Anthony
...
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 = db.GqlQuery("SELECT user_hash FROM links")
How to use Python most efficiently to filter the r...
I'm in a situation where I need to span Google App Engine entity relationships in a query like in the Django database model. I'm using ListPropertys for one-to-many relationships, like so:
class Foo(db.Model): bars = db.ListProperty(db.Key)
class Bar(db.Model): eggs = db.ListProperty(db.Key)
And I'd like to perform a query that does t...
If you have a Google App Engine project you can authenticate based on either a) anyone with a google account or b) a particular google app domain. Since you can connect these two entities I would assume there is some way to query the list of users that can be authenticated. The use case is outputting a roster of all members in an organiz...
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 workaround? I have one in mind, but it doesn't feel clean. If only GQL had a real COUNT Fun...
The Google App Engine Datastore querying language (gql) does not offer inexact operators like "LIKE" or even case insensitivity. One can get around the case sensitive issue by storing a lower-case version of a field. But what if I want to search for a person but I'm not sure of the spelling of the name? Is there an accepted pattern fo...
Is the parent 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 fa...
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 GQL have something similar
db.GqlQuery("SELECT * FROM Score WHERE points > :1", newUser...
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 app engine.
Cheers!
...
Im trying to search for some values within a date range for a specific type, but content for dates that exist in the database are not being returned by the query.
Here is an extract of the python code:
deltaDays = timedelta(days= 20)
endDate = datetime.date.today()
startDate = endDate - deltaDays
result = db.GqlQuery(
"SELECT * FRO...
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
...
Hi All,
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 Example, if you have a self created Users Table and a Message Table
Where there is a ...
I use the following data:
date latitude route name longitude
2009-04-11 00:50:31.640000 40.80708 White Loop 86 -77.85891
2009-04-11 00:50:27.718000 40.80708 White Loop 86 -77.85891
2009-04-11 00:50:01.562000 40.80708 White Loop 86 -77.85891
2009-04-11 00:49:48.765000 40.80708 White Loop 86 -77.85891
...
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 = db.TimeProperty(required=True)
And let's say I have a Station object stored in the var foo.
How d...
If I have two tables, Customers and Orders, and I want to look up the latest order for a customer, how would I do this on Google App Engine using GQL?
Normally, I would join these two tables through the foreign key, customer_id, which exists in the orders table.
select orders.* from customers, orders
where customers.customer_id = ord...
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?
...
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()
clas...
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 ahead of time!
...
I have some models set up like:
class Apps(db.Model):
name = db.StringProperty(multiline=False)
description = db.TextProperty()
class AppScreenshots(db.Model):
image_file = db.StringProperty(multiline=False)
description = db.StringProperty(multiline=False)
app = db.ReferenceProperty(Apps)
...
In MySQL it's like:
select * from table1 where column1 in ('a','b','c');
how to do that in GQL?
...