GQL – Web Development


Okay. Another difference is, in this class, we’ve been talking about SQL and in the app store, we’ve got something a little different. It’s called “G-quel”–GQL and it’s basically a simplified version of SQL that works only in the Datastore. And the main difference is all queries begin with SELECT* so there’s no way to select individual columns– So this actually simplifies a lot of queries we can do. For example, we can’t do joins, which is why I didn’t want to spend a whole lot of time on joins earlier. Even if I were working in a SQL database, I probably wouldn’t be doing a whole lot of joins and in the App Engine Datastore, we won’t be doing any joins whatsoever because it’s not possible. When we’re using GQL– actually, we don’t even have to use GQL at all. The Datastore has a kind of procedural language you could use as well. But since we’ve spent all this time practicing SQL and you’ll probably use it elsewhere in your career, we’re going to use GQL for this example. So we can at least have some consistency there. Another difference is in a kind of generic SQL database, as we’ve been talking about. You can run arbitrary queries– no matter how slow, with or without indices. And in App Engine, all queries must be indexed. This is important, right–because when you’re running your own database, you can do whatever you want. But Google–it’s very nice of them to give us this whole system for free– at least for small-use cases– but we can’t beat their machines to death. All the queries must be indexed. It’s actually not just so we don’t beat them to death but it’s just the way the whole system is built. As you get more familiar with it, it’ll kind of make sense– why things are designed the way they are. So for the most part, in this example that I’m going to build and your homework, you won’t actually have to build any indices yourself. Google App Engine will actually build the indices for you, which is really handy. If you wanted control over what indices they build– yes, you can do that yourself. Sometimes, it might build, not the most efficient index, and you can define your own–so that’s pretty cool as well.

Be the first to comment

Leave a Reply

Your email address will not be published.


*