I want to write a query that does something like this SQL query:
SELECT name FROM contacts WHERE blah blah
I know I can do something like this:
for contact in Contacts.gql(WHERE_CLAUSE, args).fetch(1000):
print contact.name
but isn’t there a way to get name directly from a query without having to loop on the results? would it provide any advantage in performance?
Nope. Can’t be done.
http://code.google.com/appengine/docs/python/datastore/gqlreference.html
But you can create a simple wrapper to do it for you. Something like:
Performance can’t be improved that way as the entire “line” is read by the API no matter what. Either you read the entire “line” or just its key.