Google app engine How to count SUM from datestore?
Hey, 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 ? ...
Hey, 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 ? ...
I have some records in datastore, I want to delete a specific record from the table. for example in SQL , we use delete * from table1 where name ="mike" what is the equivalent code in java (I m using Eclipse with Google appengine API plugin)? or any other method to do that? ...
I have public class QuantityType { @PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) private Key key; @Persistent private String type; } I am trying to setup a query to get the right QuantityType by it's key gql = "select * from QuantityType where __key__='aght52oobW1hIHTWVzc2FnZRiyAQw'"; Bu...
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 about another solution how to store these data in AppEngine database and ask for them wi...
Hi, I have an app in app engine which has a lot (expected to be in the range of 10 million + ) of tuples in database. For creating reports based on that app, I need to do a lot of aggregate functions, especially COUNT(). Since GQL does not support COUNT(), the only option seems to be sharding - http://code.google.com/appengine/article...
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 ...
Hi there, I currently work with Google's AppEngine and I could not find out, whether a Google DataStorage Object Entry has an ID by default, and if not, how I add such a field and let it increase automatically? regards, ...
In reference to this two questions (see links below) and the Google AppEngine doc, I got a little bit confused: class Author(db.Model): name = db.StringProperty() class Story(db.Model): author = db.ReferenceProperty(Author) story = db.get(story_key) author_name = story.author.name source google The doc example indicates th...
I have some entities that have a StringProperty and I would like to query for all the entities that match a substring. Is there a way to do that using just GQL? For example, if my datastore looks like this: ID/Name question_text -------------------------------------------------------------- 3001 I like to eat chicken. 3020 ...
INSERT INTO {$table_prefix}_players (id, name, v1, p1, r1) VALUES ('$id', '$name', '$villages', '$points', '$rank') ON DUPLICATE KEY UPDATE p7=p6 , p6=p5 , p5=p4 , p4=p3 , p3=p2 , p2=p1 , p1='$points' , v7=v6 , v6=v5 , v5=v4 , v4=v3 , v3=v2 , v2=v1 , v1='$villages' , r7=r6 , r6=r5 , r5=r4 , r4=r3 , r3=r2 , r2=r1 , r1='$rank'" Hi ...
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. randy_res = Vote.all().filter('created_by=', randy).fetch(limit=10) randy_res = Vote.gql('WHERE...
Say I have 2 kind: class Account(db.Model): name = db.StringProperty() create_time = db.DataTimeProperty() last_login = db.DateTimeProperty() last_update = db.DataTimeProperty() class Relationship(db.Model) owner = db.ReferenceProperty(Account) target = db.ReferenceProperty(Account) type = db.IntegerProperty() I want...
I have a model containing ranges of IP addresses, similar to this: class Country(db.Model): begin_ipnum = db.IntegerProperty() end_ipnum = db.IntegerProperty() On a SQL database, I would be able to find rows which contained an IP in a certain range like this: SELECT * FROM Country WHERE ipnum BETWEEN begin_ipnum AND end_ipnum o...
I'd like to create a gql query through my browser dashboard to easily look up specific entries, i.e. something like: SELECT * FROM MyEntity where mString = "SpecificEntity" but I can't quite get the syntax right. I see a lot of examples using parameter binding/substitution (not sure what it is called), but I don't know how to simply ...
for example, 2 classes in a 1-to-many relationship: class owner(db.model): name = db.StringProperty() class cat(db.model): name = db.StringProperty() owner = db.ReferenceProperty(owner) so how do i produce a list of cats ordered by owner.name (then optionally by cat.name)? i tried "SELECT * FROM cat ORDER BY owner.na...
I need to change values for an entry, but the following code doesn't work. logList = db.GqlQuery("SELECT * FROM Log ORDER BY date DESC LIMIT 1") logList[0].content = "some text" db.put(logList) The value for the newest element doesn't change when I run this. I checked the output with Print, it gives correct value (to what the content...
Is it possible to select from a google app engine db where the key of a db.Model object is not in a given list? If so, what would be the syntax? Ex of a model class: class Spam(db.Model): field1 = db.BooleanProperty(default=false) field2 = db.IntegerProperty() Example of a query which I'd like to work but can't figure out: ...
If I have an db.Model object such as: class Foo(db.Model): title = db.StringProperty() bars = db.ListProperty(db.Key) and I wanted to query the datastore for all of the Foo entities and sort that set by the Foo objects that have the most bars, how would I write the GQL? I was hoping for something as simple as: fooQuery = db....
How do I find the maximum value in a particular column of a table in the GAE datastore using GQL? ...
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 = <numeric_id> also doesn't work. ...