def select(self, query, model_class=None, settings=None):
query += '<STR_LIT>'<EOL>query = self._substitute(query, model_class)<EOL>r = self._send(query, settings, True)<EOL>lines = r.iter_lines()<EOL>field_names = parse_tsv(next(lines))<EOL>field_types = parse_tsv(next(lines))<EOL>model_class = model_class or ModelBase.create_ad_hoc_model(zip(field_names, field_types))<EOL>for line in lines:<EOL><INDENT>if line:<EOL><INDENT>yield model_class.from_tsv(line, field_names, self.server_timezone, self)<EOL><DEDENT><DEDENT>
Performs a query and returns a generator of model instances.

- `query`: the SQL query to execute.
- `model_class`: the model class matching the query's table,
  or `None` for getting back instances of an ad-hoc model.
- `settings`: query settings to send as HTTP GET parameters