title: Get number of rows in a BigQuery table (streaming buffer)
body: <p>I am doing inserts via Streaming. In the UI, I can see the following row counts:</p>
  
  <p><a href="https://i.stack.imgur.com/YGcsj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YGcsj.png" alt="enter image description here"></a></p>
  
  <p>Is there a way to get that via the API? Current when I do:</p>
  
  <pre><code>from google.cloud import bigquery
  client = bigquery.Client()
  dataset = client.dataset("bqtesting")
  table = client.get_table(dataset.table('table_streaming'))
  table.num_rows
  0
  </code></pre>
  
  <p>Obviously 0 is not the number that I'm looking to get. From the API documentation it says:</p>
  
  <blockquote>
    <p>numRows   unsigned long   [Output-only] The number of rows of data in this table, excluding any data in the streaming buffer.</p>
  </blockquote>
  
  <p>So then, my question is: how do we get the exact number of rows in a table? Currently I'm doing:</p>
  
  <pre><code>count=[item[0] for item in client.query('SELECT COUNT(*) FROM `bqtesting.table_streaming`').result()][0]    
  </code></pre>
  
  <p>But this takes about 5s just to get the count (and I need to execute this query quite frequently to see if all streaming inserts have 'finished').</p>