Google app engine datastore GQL

GQL is a SQL-like language for retrieving entities or keys from the App Engine scalable datastore. 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.

โดยกฏการคิวรี่เหมือนเดิมตาม Restrictions on queries
Example SQL syntax
sql = “SELECT * FROM YOUR_KIND WHERE YOUR_FIELD [>,>=,<,<=,=,!=] [value] ORDER BY YOUR_FIELD [DESC|ASC] LIMIT [number] OFFSET [number]
Example SQL
sql = “SELECT * FROM Test WHERE id = 1 ORDER BY id desc LIMIT 1 OFFSET 0

try:
    if self.request.get('sql') != '':
        q = db.GqlQuery(self.request.get('sql'))
        ...
except db.Error, exStr:
    self.response.out.write("Exception db.Error \n<font color='red'>"+str(exStr)+"</font>")

ข้อมูลเพิ่มเติม
https://developers.google.com/appengine/docs/python/datastore/gqlreference

Related posts:

This entry was posted in google app engine. Bookmark the permalink.