def _get_row_fetcher(self, start_row=0, max_rows=None, page_size=_DEFAULT_PAGE_SIZE):
    """ Get a function that can retrieve a page of rows.

    The function returned is a closure so that it can have a signature suitable for use
    by Iterator.

    Args:
      start_row: the row to start fetching from; default 0.
      max_rows: the maximum number of rows to fetch (across all calls, not per-call). Default
          is None which means no limit.
      page_size: the maximum number of results to fetch per page; default 1024.
    Returns:
      A function that can be called repeatedly with a page token and running count, and that
      will return an array of rows and a next page token; when the returned page token is None
      the fetch is complete.
    """
    if not start_row:
      start_row = 0
    elif start_row < 0:  # We are measuring from the table end
      if self.length >= 0:
        start_row += self.length
      else:
        raise Exception('Cannot use negative indices for table of unknown length')

    schema = self.schema._bq_schema
    name_parts = self._name_parts

    def _retrieve_rows(page_token, count):

      page_rows = []
      if max_rows and count >= max_rows:
        page_token = None
      else:
        if max_rows and page_size > (max_rows - count):
          max_results = max_rows - count
        else:
          max_results = page_size

        try:
          if page_token:
            response = self._api.tabledata_list(name_parts, page_token=page_token,
                                                max_results=max_results)
          else:
            response = self._api.tabledata_list(name_parts, start_index=start_row,
                                                max_results=max_results)
        except Exception as e:
          raise e
        page_token = response['pageToken'] if 'pageToken' in response else None
        if 'rows' in response:
          page_rows = response['rows']

      rows = []
      for row_dict in page_rows:
        rows.append(_parser.Parser.parse_row(schema, row_dict))

      return rows, page_token

    return _retrieve_rows
def _get_row_fetcher ( self , start_row = 0 , max_rows = None , page_size = _DEFAULT_PAGE_SIZE ) : if not start_row : start_row = 0 elif start_row < 0 : if self . length >= 0 : start_row += self . length else : raise Exception ( 'Cannot use negative indices for table of unknown length' ) schema = self . schema . _bq_schema name_parts = self . _name_parts def _retrieve_rows ( page_token , count ) : page_rows = [ ] if max_rows and count >= max_rows : page_token = None else : if max_rows and page_size > ( max_rows - count ) : max_results = max_rows - count else : max_results = page_size try : if page_token : response = self . _api . tabledata_list ( name_parts , page_token = page_token , max_results = max_results ) else : response = self . _api . tabledata_list ( name_parts , start_index = start_row , max_results = max_results ) except Exception as e : raise e page_token = response [ 'pageToken' ] if 'pageToken' in response else None if 'rows' in response : page_rows = response [ 'rows' ] rows = [ ] for row_dict in page_rows : rows . append ( _parser . Parser . parse_row ( schema , row_dict ) ) return rows , page_token return _retrieve_rows
Get a function that can retrieve a page of rows.

    The function returned is a closure so that it can have a signature suitable for use
    by Iterator.

    Args:
      start_row: the row to start fetching from; default 0.
      max_rows: the maximum number of rows to fetch (across all calls, not per-call). Default
          is None which means no limit.
      page_size: the maximum number of results to fetch per page; default 1024.
    Returns:
      A function that can be called repeatedly with a page token and running count, and that
      will return an array of rows and a next page token; when the returned page token is None
      the fetch is complete.