title: BigQuery Python API copy_table copies schema but not data
body: <p>I'm trying to copy one BigQuery table to another, within the same dataset, working off of the example at <a href="https://cloud.google.com/bigquery/docs/managing-tables#copy-table" rel="nofollow noreferrer">https://cloud.google.com/bigquery/docs/managing-tables#copy-table</a></p>
  <p>I've created a function to do the copy, as follows:</p>
  <pre><code>def copy_table (source_table,dest_table):
      client = bigquery.Client()
      source_table_ref=&quot;my_project.my_dataset.&quot;+source_table
      dest_table_ref=&quot;my_project.my_dataset.&quot;+dest_table
  
      job = client.copy_table(
          source_table_ref,
          dest_table_ref)  # API request
      job.result()
  </code></pre>
  <p>But when I do the copy, the dest_table is created, with the same schema as the source_table, but none of the data is copied from the source_table to the dest_table.</p>
  <p>Here's the overall sequence of what I'm doing:</p>
  <ol>
  <li>Create source_table</li>
  <li>Insert rows into source_table</li>
  <li>Do query to check that the rows are in the source_table (they are -- SELECT COUNT(*) returns the right number of rows)</li>
  <li>Copy source_table to dest_table using the function above</li>
  <li>Do query to check that the rows are in the dest_table (they are NOT -- SELECT COUNT(*) returns zero rows)</li>
  </ol>
  <p>My guess is that somehow these jobs are being executed asynchronously, but I can't figure out how to make them execute synchronously. Any ideas would be greatly appreciated.</p>
  <p>If it helps any, my overall goal is to create and fill a new table with the results of a daily batch job (get_user_info_2020-06-27, for example), then copy it to a get_user_info_current table that always contains the current day's user info.</p>
  <p>Edit:</p>
  <p>Some more info, based on testing:</p>
  <p>On the page at <a href="https://cloud.google.com/bigquery/streaming-data-into-bigquery#dataavailability" rel="nofollow noreferrer">https://cloud.google.com/bigquery/streaming-data-into-bigquery#dataavailability</a>, it says: &quot;Data can take up to 90 minutes to become available for copy operations&quot;. So, I coded up a little thing to go after my insert statement to wait until it completes:</p>
  <pre><code>def insert_table_wait(table_name,prev_rows,rows_inserted):
      client = bigquery.Client()
      table_id = &quot;pacs-user-analysis-dev.google_users.&quot;+table_name
      table = client.get_table(table_id)  # Make an API request.
  
      #wait until the insert fully completes
      curr_table=client.get_table(table_id)
      sys.stderr.write(str(datetime.datetime.now()) +&quot; &quot;+table_name +&quot; properties: &quot;+str(curr_table._properties)+&quot;\n&quot;)
      curr_rows=int(curr_table._properties.get('numRows'))
      while curr_table._properties.get('streamingBuffer') is not None or curr_rows != prev_rows+rows_inserted:
          sys.stderr.write(str(datetime.datetime.now()) +&quot; Waiting for insert into &quot;+str(curr_table._properties.get('id'))+&quot; to complete. StreamingBuffer details: &quot;+str(curr_table._properties.get('streamingBuffer'))+&quot; prev_rows: &quot;+str(prev_rows)+&quot; curr_rows: &quot;+str(curr_rows)+ &quot; should be: &quot; + str(prev_rows+rows_inserted)+&quot;\n&quot;)
          time.sleep(10)
          curr_table=client.get_table(table_id)
          curr_rows=int(curr_table._properties.get('numRows') )
  </code></pre>
  <p>I'm hoping that that might fix things. What I don't understand is that the new rows appear in the BigQuery Console UI almost immediately, but table._properties.get('numRows') doesn't seem to update nearly as promptly.</p>