PHP Класс Google\Cloud\BigQuery\QueryResults

This class should be not instantiated directly, but as a result of calling {@see \Google\Cloud\BigQuery\BigQueryClient::runQuery()} or {@see \Google\Cloud\BigQuery\Job::queryResults()}.
Показать файл Открыть проект

Защищенные свойства (Protected)

Свойство Тип Описание
$connection Google\Cloud\BigQuery\Connection\ConnectionInterface Represents a connection to BigQuery.

Открытые методы

Метод Описание
__construct ( Google\Cloud\BigQuery\Connection\ConnectionInterface $connection, string $jobId, string $projectId, array $info, array $reloadOptions, ValueMapper $mapper )
identity ( ) : array Retrieves the query result's identity.
info ( ) : array Retrieves the cached query details.
isComplete ( ) : boolean Checks the query's completeness. Useful in combination with {@see Google\Cloud\BigQuery\QueryResults::reload()} to poll for query status.
reload ( array $options = [] ) : array Triggers a network request to reload the query's details.
rows ( array $options = [] ) : array Retrieves the rows associated with the query and merges them together with the table's schema. It is recommended to check the completeness of the query before attempting to access rows.

Описание методов

__construct() публичный Метод

public __construct ( Google\Cloud\BigQuery\Connection\ConnectionInterface $connection, string $jobId, string $projectId, array $info, array $reloadOptions, ValueMapper $mapper )
$connection Google\Cloud\BigQuery\Connection\ConnectionInterface Represents a connection to BigQuery.
$jobId string The job's ID.
$projectId string The project's ID.
$info array The query result's metadata.
$reloadOptions array The options to use when reloading query data.
$mapper ValueMapper Maps values between PHP and BigQuery.

identity() публичный Метод

An identity provides a description of a nested resource. Example: echo $queryResults->identity()['projectId'];
public identity ( ) : array
Результат array

info() публичный Метод

Example: $info = $queryResults->info(); echo $info['totalBytesProcessed'];
См. также: https://cloud.google.com/bigquery/docs/reference/v2/jobs/getQueryResults#response Jobs getQueryResults API response documentation.
public info ( ) : array
Результат array

isComplete() публичный Метод

Example: $isComplete = $queryResults->isComplete(); while (!$isComplete) { sleep(1); // small delay between requests $queryResults->reload(); $isComplete = $queryResults->isComplete(); } echo 'Query complete!';
public isComplete ( ) : boolean
Результат boolean

reload() публичный Метод

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 if ($queryResults->isComplete()) { echo "Query complete!"; }
См. также: https://cloud.google.com/bigquery/docs/reference/v2/jobs/getQueryResults Jobs getQueryResults API documentation.
public reload ( array $options = [] ) : array
$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). }
Результат array

rows() публичный Метод

Refer to the table below for a guide on how BigQuery types are mapped as they come back from the API. | **PHP Type** | **BigQuery Data Type** | |--------------------------------------------|--------------------------------------| | \DateTimeInterface | DATETIME | | {@see \Google\Cloud\BigQuery\Bytes} | BYTES | | {@see \Google\Cloud\BigQuery\Date} | DATE | | {@see \Google\Cloud\Int64} | INTEGER | | {@see \Google\Cloud\BigQuery\Time} | TIME | | {@see \Google\Cloud\BigQuery\Timestamp} | TIMESTAMP | | Associative Array | RECORD | | Non-Associative Array | RECORD (Repeated) | | float | FLOAT | | int | INTEGER | | string | STRING | | bool | BOOLEAN | Example: $isComplete = $queryResults->isComplete(); if ($isComplete) { $rows = $queryResults->rows(); foreach ($rows as $row) { echo $row['name'] . PHP_EOL; } }
public rows ( array $options = [] ) : array
$options array [optional] Configuration options.
Результат array

Описание свойств

$connection защищенное свойство

Represents a connection to BigQuery.
protected ConnectionInterface,Google\Cloud\BigQuery\Connection $connection
Результат Google\Cloud\BigQuery\Connection\ConnectionInterface