def fetch(self, limit, offset=0):
    """Return a list of items selected using SQL-like limit and offset.

    Whenever possible, use fetch() instead of iterating over the query
    results with run() or __iter__() . fetch() is more efficient.

    Beware: fetch() ignores the LIMIT clause on GQL queries.

    Args:
      limit: Maximum number of results to return.
      offset: Optional number of results to skip first; default zero.

    Returns:
      A list of db.Model instances.  There may be fewer than 'limit'
      results if there aren't enough results to satisfy the request.
    """
    accepted = (int, long)
    if not (isinstance(limit, accepted) and isinstance(offset, accepted)):
      raise TypeError('Arguments to fetch() must be integers')
    if limit < 0 or offset < 0:
      raise ValueError('Arguments to fetch() must be >= 0')
    if limit == 0:
      return []
    raw_query = self._get_query()
    raw = raw_query.Get(limit, offset)
    if self._compile:
      try:
        self._compiled_query = raw_query.GetCompiledQuery()
      except AssertionError, e:
        self._compiled_query = e

    if self._keys_only:
      return raw
    else:
      if self._model_class is not None:
        return [self._model_class.from_entity(e) for e in raw]
      else:
        return [class_for_kind(e.kind()).from_entity(e) for e in raw]
dataset/ETHPy150Open CollabQ/CollabQ/.google_appengine/google/appengine/ext/db/__init__.py/_BaseQuery.fetch/original