PHP Class Google\Cloud\BigQuery\Job

Datei anzeigen Open project: GoogleCloudPlatform/gcloud-php

Public Methods

Method Description
__construct ( Google\Cloud\BigQuery\Connection\ConnectionInterface $connection, string $id, string $projectId, array $info = [], ValueMapper $mapper = null )
cancel ( array $options = [] ) Requests that a job be cancelled. You will need to poll the job to ensure the cancel request successfully goes through.
exists ( ) : boolean Check whether or not the job exists.
id ( ) : string Retrieves the job's ID.
identity ( ) : array Retrieves the job's identity.
info ( array $options = [] ) : array Retrieves the job's details. If no job data is cached a network request will be made to retrieve it.
isComplete ( array $options = [] ) : boolean Checks the job's completeness. Useful in combination with {@see Google\Cloud\BigQuery\Job::reload()} to poll for job status.
queryResults ( array $options = [] ) : QueryResults Retrieves the results of a query job.
reload ( array $options = [] ) : array Triggers a network request to reload the job's details.

Method Details

__construct() public method

public __construct ( Google\Cloud\BigQuery\Connection\ConnectionInterface $connection, string $id, string $projectId, array $info = [], ValueMapper $mapper = null )
$connection Google\Cloud\BigQuery\Connection\ConnectionInterface Represents a connection to BigQuery.
$id string The job's ID.
$projectId string The project's ID.
$info array [optional] The job's metadata.
$mapper ValueMapper Maps values between PHP and BigQuery.

cancel() public method

Example: $job->cancel(); $isComplete = $job->isComplete(); while (!$isComplete) { sleep(1); // let's wait for a moment... $job->reload(); $isComplete = $job->isComplete(); } echo 'Job successfully cancelled.';
See also: https://cloud.google.com/bigquery/docs/reference/v2/jobs/cancel Jobs cancel API documentation.
public cancel ( array $options = [] )
$options array [optional] Configuration options.

exists() public method

Example: echo $job->exists();
public exists ( ) : boolean
return boolean

id() public method

Example: echo $job->id();
public id ( ) : string
return string

identity() public method

An identity provides a description of a nested resource. Example: echo $job->identity()['projectId'];
public identity ( ) : array
return array

info() public method

Example: $info = $job->info(); echo $info['statistics']['startTime'];
See also: https://cloud.google.com/bigquery/docs/reference/v2/jobs#resource Jobs resource documentation.
public info ( array $options = [] ) : array
$options array [optional] Configuration options.
return array

isComplete() public method

Example: $isComplete = $job->isComplete(); while (!$isComplete) { sleep(1); // let's wait for a moment... $job->reload(); $isComplete = $job->isComplete(); } echo 'Query complete!';
public isComplete ( array $options = [] ) : boolean
$options array [optional] Configuration options.
return boolean

queryResults() public method

Example: $queryResults = $job->queryResults();
See also: https://cloud.google.com/bigquery/docs/reference/v2/jobs/getQueryResults Jobs getQueryResults API documentation.
public queryResults ( array $options = [] ) : QueryResults
$options array [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 QueryResults

reload() public method

Example: echo $job->isComplete(); // false sleep(1); // let's wait for a moment... $job->reload(); // execute a network request echo $job->isComplete(); // true
See also: https://cloud.google.com/bigquery/docs/reference/v2/jobs/get Jobs get API documentation.
public reload ( array $options = [] ) : array
$options array [optional] Configuration options.
return array