The query API
Now that we understand how queries work under the hood, along with its their limitations and workarounds, it is time to learn more about the query API. As we have already seen briefly, there are two interfaces through which you can query your data. One is the object-oriented way where you can create query objects, call methods on them to tailor them according to your needs, and fetch results. The other is the SQL-like interface, which only allows you to read data. Thus, the only available statement is SELECT
. This language is called GQL. Whatever queries you issue in GQL are translated into its equivalent object-oriented API.
Previously, the datastore API was available under the db
package and was not very intuitive. Besides this, there was no caching available. So, every query that you issued would hit the underlying datastore, thus counting towards the quota limits. You could use the Memcahce API to manually store the fetched results on your own and invalidate the cache.
Then...