BigQuery Client - Class InsertResponse (1.24.2)

Reference documentation and code samples for the BigQuery Client class InsertResponse.

Represents the result of streaming data into a table.

This class should be not instantiated directly, but as a result of calling Google\Cloud\BigQuery\Table::insertRow() or Google\Cloud\BigQuery\Table::insertRows().

Methods

__construct

Parameters
NameDescription
info array

The API response.

rows array

The rows provided in the original request.

isSuccessful

Determines if the request was successful.

Example:

if (!$insertResponse->isSuccessful()) {
   print_r($insertResponse->failedRows());
}
Returns
TypeDescription
bool

failedRows

Returns the rows which failed to insert along with their associated errors and index in the original data set.

Example:

$rows = $insertResponse->failedRows();

foreach ($rows as $row) {
    print_r($row['rowData']) . PHP_EOL;

    foreach ($row['errors'] as $error) {
        echo $error['reason'] . ': ' . $error['message'] . PHP_EOL;
    }
}
Returns
TypeDescription
array

info

Retrieves the full API response.

Example:

$info = $insertResponse->info();
print_r($info['insertErrors']);
Returns
TypeDescription
array