I’m just staring off with GAE. So like many I’m used to standard SQL.
Typically when you want to select data that has a certain field value you use:
SELECT <columns> FROM <table> WHERE <column> = <wanted value>
Is the correct way to do this in GAE
<Model Class>.all().filter('<column> =', <wanted value>)
Or is there a more efficient way?
EDIT: Also I should note in this particular case I only want one result returned. So is there another command so that it doesn’t keep looking after if finds a result?
Your code is pretty close to what you’re looking for – it constructs a Query object which can be used to query the datastore. To actually get a result, you’ll need to execute the query. To get a single result, you’ll want to use the
get()method: