Let's say I have a model like this
class Foo(db.Model):
id = db.StringProperty()
bar = db.StringProperty()
baz = db.StringProperty()
And I'm going a GqlQuery like this
foos = db.GqlQuery("SELECT * FROM Foo")
I want to take the results of the GqlQuery and turn into some sort of JSON string that I can manipulate from diff...
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...
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...
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
...
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
...
I am trying to compare the key to filter results in gql in python but the direct comparision nor typecasting to int works. There fore I am forced to make a work around as mentioned in uncommented lines below. Any clues.
row = self.request.get("selectedrow")
#mydbobject = DbModel.gql("WHERE key=:1", row).fetch(1)
#mydbobject = DbModel.gq...
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?
...
I have this datastore model
class Project(db.Model)
projectname = db.StringProperty()
projecturl = db.StringProperty()
class Task(db.Model)
project = db.ReferenceProperty(Project)
taskname= db.StringProperty()
taskdesc = db.StringProperty()
How do I edit the value of taskname ? say I have task1 and i want to change it to task1-project...
How do I know if the results of my query either using the Query interface or the GqlQuery interface returned zero results? Would using .get() on zero results produce an error? If yes, what's the best way to handle it?
...
Hi,
I am very new to sql and more over GQL used in Google app engine. I have managed to push my data to the Google servers but I am not able to figure out a way to query from the entities I've loaded to the datastrore.
Here's the problem, i want to query only the names and numbers of a user's contacts marked by user id apart from other...
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...
Hi,
I am able to properly pass a string variable to the gqlquery through parameter substitution, here's the code i've tried to use;
user_name = self.request.get('username') #retrieved from UI
p = models.UserDetails.all().filter('user_name = ', user_name).fetch(1)
I don't get any results and the query fails silently. But when I hard c...
I have the following model of Users and I want to get all the users that like 'yellow', but don't like 'red'.
class User(db.Model):
name = db.StringProperty(required=True)
favorite_colors = db.StringListProperty(required=True)
This works (all users that have at least one favorite color 'yellow' are returned):
results = db.Gql...
I have the following models:
class Author(db.Model):
name = db.StringProperty()
class Story(db.Model):
author = db.ReferenceProperty(Author)
What's the raw GQL to find all Stories by a certain author. In regular SQL, I will use joins but I don't think that's available in GQL.
Edit:
I'm looking for the raw GQL way, I know h...
So the situation is: I want to optimize my code some for doing counting of records. So I have a parent Model class Base, a PolyModel class Entry, and a child class of Entry Article: How would I query Article.key so I can reduce the query load but only get the Article count.
My first thought was to use:
q = db.GqlQuery("SELECT __key__ f...
I have three records in a table
example:
*Usernames* *email* *city*
Nick [email protected] London
Vikky [email protected] Paris
Lisa [email protected] Sydney
Now I want to get specific record keeping email ID as a key ,
SQL query may be like this
select * fr...
I'm trying to understand how I can use the local server time to quickly filter results on google appengine. It seems to me that there should be a simple way of doing this using DATETIME(time.localtime()).
For example (where 'timestamp' is of type db.DateTimeProperty)...
q = db.GqlQuery("SELECT * FROM LiveData WHERE timestamp > DATETIME...
Anyone have a good reference guide for GQL (query language for google appengine datastore)?
I find the reference guide on the google appengine site very limited with examples
...