title: how to get all rows from a bigquery result in python?
body: <p>I'm trying to get all results from a BQ query but I can only get 100 results.</p>
  <p>Given the <a href="https://github.com/googleapis/google-cloud-python/issues/9259" rel="nofollow noreferrer">borked python BQ iterator API</a> what's the best way to do this?</p>
  <p>based on these docs:
  <a href="https://cloud.google.com/bigquery/docs/paging-results" rel="nofollow noreferrer">https://cloud.google.com/bigquery/docs/paging-results</a></p>
  <p>I have all this code (to do something really basic) but still only get 100 results...</p>
  <p>I must be missing something in the API, this should not be so complicated.</p>
  <pre class="lang-py prettyprint-override"><code>
  bqc = bigquery.Client(credentials=bq_creds, project=bq_creds.project_id)
  
  def query(qstring, getall=True):
      '''run a time query string'''
      logger.info('query&gt;&gt; %s', qstring)
      try:
          job = bqc.query(qstring)
          result = job.result()
      except Exception as err:
          logging.error('failed BQ job %s', err)
          raise err
  
      if getall:
          result = get_all(result, job)
      return result
  
  
  def get_all(cursor, job):
      '''unwind the bq data'''
      destination = job.destination
      destination = bqc.get_table(destination)
  
      # Download rows.
      # The client library automatically handles pagination.
      rows = bqc.list_rows(destination, max_results=5000)
      data = []
      for row in rows:
          data.append(row)
      logging.info('get_all rows: %s', len(data))
      return data
  
  </code></pre>
  <p>(Then a follow-on question is how to make this BQ data JSON serializable)</p>