コード例 #1
0
 /**
  * Creates a dataset.
  *
  * Example:
  * ```
  * $dataset = $bigQuery->createDataset('aDataset');
  * ```
  *
  * @see https://cloud.google.com/bigquery/docs/reference/v2/datasets/insert Datasets insert API documentation.
  *
  * @param string $id The id of the dataset to create.
  * @param array $options [optional] {
  *     Configuration options.
  *
  *     @type array $metadata The available options for metadata are outlined
  *           at the
  *           [Dataset Resource API docs](https://cloud.google.com/bigquery/docs/reference/v2/datasets#resource)
  * }
  * @return Dataset
  */
 public function createDataset($id, array $options = [])
 {
     if (isset($options['metadata'])) {
         $options += $options['metadata'];
         unset($options['metadata']);
     }
     $response = $this->connection->insertDataset(['projectId' => $this->projectId, 'datasetReference' => ['datasetId' => $id]] + $options);
     return new Dataset($this->connection, $id, $this->projectId, $response);
 }
コード例 #2
0
 /**
  * Triggers a network request to reload the query's details.
  *
  * Useful when needing to poll an incomplete query
  * for status. Configuration options will be inherited from
  * {@see Google\Cloud\BigQuery\Job::queryResults()} or
  * {@see Google\Cloud\BigQuery\BigQueryClient::runQuery()}, but they can be
  * overridden if needed.
  *
  * Example:
  * ```
  * $queryResults->isComplete(); // returns false
  * sleep(1); // let's wait for a moment...
  * $queryResults->reload(); // executes a network request
  * $queryResults->isComplete(); // true
  * ```
  *
  * @see https://cloud.google.com/bigquery/docs/reference/v2/jobs/getQueryResults
  * Jobs getQueryResults API documentation.
  *
  * @param array $options [optional] {
  *     Configuration options.
  *
  *     @type int $maxResults Maximum number of results to read.
  *     @type int $startIndex Zero-based index of the starting row.
  *     @type int $timeoutMs How long to wait for the query to complete, in
  *           milliseconds. **Defaults to** `10000` milliseconds (10 seconds).
  * }
  * @return array
  */
 public function reload(array $options = [])
 {
     $options += $this->identity;
     return $this->info = $this->connection->getQueryResults($options + $this->reloadOptions);
 }
コード例 #3
0
 /**
  * Triggers a network request to reload the job's details.
  *
  * Example:
  * ```
  * echo $job->isComplete(); // false
  * sleep(1); // let's wait for a moment...
  * $job->reload(); // execute a network request
  * echo $job->isComplete(); // true
  * ```
  *
  * @see https://cloud.google.com/bigquery/docs/reference/v2/jobs/get Jobs get API documentation.
  *
  * @param array $options [optional] Configuration options.
  * @return array
  */
 public function reload(array $options = [])
 {
     return $this->info = $this->connection->getJob($options + $this->identity);
 }