gql

What Does a Blank GQL Result Look Like?

Hello, I am working on a Google App Engine application, and have been facing some issues with a GQL query and an if statement. This is the code: q = Song.gql("WHERE title = :1", self.request.get('song_title')) q.get() if q: r = "Excisting Results Found: <br />" print q for song in q: r += song.title+" by "+song.artis...

AppEngine: Query datastore for columns with a hyphen in its name

I'm working on a servlet in Google App Engine. This servlet retrieves the data from the GAE's datastore; everything works fine when querying like "SELECT * FROM...". But when I want to filter it by a certain column, it does not work since the name of the column has a hypen. It is like the following: Query query = new Query("tableName");...

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: agtzcG9................... This query does not work: SELECT * FROM Programme where na...

GQL with two tables

Hello i am doing a very small application in google appengine and i use python. My problem is that i have two tables using de db.model ("clients" and "requests"). The table "client" has got the email and name fields and the table "requests" has got the email and issue fields. I want to do a query that returns for each request the email, ...

Simple Question: How to get current date in Java to be used in GQL query?

I have a Users table that has an element called "date". I would like to make these pseudocode queries work in Java: select * from Users WHERE date=today and also select * from Users WHERE date "in this hour" How can I write the queries? I am using Google App Engine, and the date was initially created using java.util.Date. Please he...

iPhone app with Goole App Engine

I've prototyped an iPhone app that uses (internally) sqLite as its data base. The intent was to ultimately have it communicate with a server via PHP, which would use mySQL as the backend database. I just discovered Google App Engine, however, but know very little about it. I think it'd be nice to use the Python interface to write to...

GQL query with "like" operator

Possible Duplicate: Google App Engine: Is it possible to do a Gql LIKE query? In SQL (T-SQL at least) you can write a query that uses the "like" operator, something like this: select * from MyTable where MyColumn like '%something%' Is there any way to do this in GQL? ...

Simple question: How to enter item into Google AppEngine Datastore?

I want to check if an email is in my database in Appengine, and if not: then enter it into the datastore. I am new to python. Why is this simple code not working? (Also If there is a better way/more efficient way to write this, please tell me) (I get the error: BadArgumentError: Unused positional arguments [1]) class EmailAdd(webapp....

What's the raw GQL to check a ReferenceProperty?

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...

Google app engine database values not incrementing

Here is some code that is not working how it is supposed to work. Every time the database is queried, I get either a 0 or 1 value for the options, and the values in database do not increment, even though as as you can see, in line 86 and 89, the values are being incremented. Any idea what's going wrong here? I am using Django on Google A...

placement of sorted entry in google appengine datastore

I'd like to determine what place a particular entry is in, but the appropriate GQL query is escaping me. Ideally I'd like to know the following details, which seem like they should be known by the datastore. I just can't seem to figure how to determine it. Can someone help? the placement of a particular entry (in a given sorting, i....

Google App Engine: Model integrity constraints?

I have a datastore model representing items in an ecommerce site: class Item(db.Model): CSIN = db.IntegerProperty() name = db.StringProperty() price = db.IntegerProperty() quantity = db.IntegerProperty() Is there some way to enforce integrity constraints? For instance, I would like to make sure that quantity is never s...

GQL Request BadArgument Error. How to get around with my case?

My query is essentially the following: entries=Entry.all().order("-votes").order("-date").filter("votes >", VOTE_FILTER).fetch(PAGE_SIZE+1, page* PAGE_SIZE) I want to grab N of the latest entries that have a voting score above some benchmark (VOTE_FILTER). Google currently says that I cannot filter on 'votes' because I order by 'date....

How to do batch Google DataStore key lookup query in JDO

I have about 50k entities stored in appengine. I am able to look up an individual record via the GQL admin interface with a query like: SELECT * FROM Pet where __key__ = KEY( 'Pet','Fido') But I'm having trouble figuring out how to do a batch version of this via JDO. Right now I have this: PersistenceManager pm = ...; for(...

GQL example for server side admin console query with reference property filter.

How to construct a GQL query using server side admin datastore viewer, a one that filters on a reference property? SELECT * from Model where reference_property = <what goes here> ...

GQL: I'm storing JSON in the DataStore. All json is getting converted to html entities, how to avoid this?

The tittle says most: I'm storing JSON in the DataStore. All json is getting converted to html entities, how can I avoid this? Original I had myJson = db.StringProperty() it complained the json i had was to long and StringProperty had a limit of around 500 chars. Sugesting to use TextProperty instead. It inserted without problems bu...

Problem using date when querying the appengine datastore

I'm running this query: SELECT FROM com.Data WHERE entryDate > DATE('2010-3-16') I get this error: org.datanucleus.store.appengine.query.DatastoreQuery$UnsupportedDatastoreFeatureException: Problem with query DATE('2010-3-16')>: Unsupported method while parsing expression: InvokeExpression{[null].DATE(Literal{2010-3-16})} The same ...

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, when using an offset the engine will still fetch all the rows, only not return them, thus...

GQL query help - How can I write a query with where clause in GQL ? I am using google appengine datastore

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...

How to retrieve Google App Engine entities by ancestor

I have the following 2 models in my Google App Engine datastore: class Search(db.Model): what = db.StringProperty() class SearchResult(db.Model): search = db.ReferenceProperty(Search) title = db.StringProperty() content = db.StringProperty() And, I am trying to retrieve all SearchResult entities for a given Search en...