Example #1
0
 /**
  * Runs a copy job which copies this table to a specified destination table.
  *
  * Example:
  * ```
  * $sourceTable = $bigQuery->dataset('myDataset')->table('mySourceTable');
  * $destinationTable = $bigQuery->dataset('myDataset')->table('myDestinationTable');
  *
  * $sourceTable->copy($destinationTable);
  * ```
  *
  * @see https://cloud.google.com/bigquery/docs/reference/v2/jobs Jobs insert API Documentation.
  *
  * @param Table $destination The destination table.
  * @param array $options [optional] {
  *     Configuration options.
  *
  *     @type array $jobConfig Configuration settings for a copy job are
  *           outlined in the [API Docs for `configuration.copy`](https://goo.gl/m8dro9).
  *           If not provided default settings will be used.
  * }
  * @return Job
  */
 public function copy(Table $destination, array $options = [])
 {
     $config = $this->buildJobConfig('copy', $this->identity['projectId'], ['destinationTable' => $destination->identity(), 'sourceTable' => $this->identity], $options);
     $response = $this->connection->insertJob($config);
     return new Job($this->connection, $response['jobReference']['jobId'], $this->identity['projectId'], $response);
 }