Reference documentation and code samples for the Cloud Bigtable V2 Client class BigtableClient.
Service Description: Service for reading from and writing to existing Bigtable tables.
This class provides the ability to make remote calls to the backing service through method calls that map to API methods.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parseName method to extract the individual identifiers contained within formatted names that are returned by the API.
Namespace
Google \ Cloud \ Bigtable \ V2 \ ClientMethods
__construct
Constructor.
Setting the "BIGTABLE_EMULATOR_HOST" environment variable will automatically set the API Endpoint to the value specified in the variable, as well as ensure that empty credentials are used in the transport layer.
Parameters | |
---|---|
Name | Description |
options |
array
Optional. Options for configuring the service API wrapper. |
↳ apiEndpoint |
string
The address of the API remote host. May optionally include the port, formatted as "
|
↳ credentials |
string|array|FetchAuthTokenInterface|CredentialsWrapper
The credentials to be used by the client to authorize API calls. This option accepts either a path to a credentials file, or a decoded credentials file as a PHP array. Advanced usage: In addition, this option can also accept a pre-constructed Google\Auth\FetchAuthTokenInterface object or Google\ApiCore\CredentialsWrapper object. Note that when one of these objects are provided, any settings in $credentialsConfig will be ignored. |
↳ credentialsConfig |
array
Options used to configure credentials, including auth token caching, for the client. For a full list of supporting configuration options, see Google\ApiCore\CredentialsWrapper::build() . |
↳ disableRetries |
bool
Determines whether or not retries defined by the client configuration should be disabled. Defaults to |
↳ clientConfig |
string|array
Client method configuration, including retry settings. This option can be either a path to a JSON file, or a PHP array containing the decoded JSON data. By default this settings points to the default client config file, which is provided in the resources folder. |
↳ transport |
string|TransportInterface
The transport used for executing network requests. May be either the string |
↳ transportConfig |
array
Configuration options that will be used to construct the transport. Options for each supported transport type should be passed in a key for that transport. For example: $transportConfig = [ 'grpc' => [...], 'rest' => [...], ]; See the Google\ApiCore\Transport\GrpcTransport::build() and Google\ApiCore\Transport\RestTransport::build() methods for the supported options. |
↳ clientCertSource |
callable
A callable which returns the client cert as a string. This can be used to provide a certificate and private key to the transport layer for mTLS. |
↳ logger |
false|LoggerInterface
A PSR-3 compliant logger. If set to false, logging is disabled, ignoring the 'GOOGLE_SDK_PHP_LOGGING' environment flag |
checkAndMutateRow
Mutates a row atomically based on the output of a predicate Reader filter.
The async variant is BigtableClient::checkAndMutateRowAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Bigtable\V2\CheckAndMutateRowRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\Bigtable\V2\CheckAndMutateRowResponse |
use Google\ApiCore\ApiException;
use Google\Cloud\Bigtable\V2\CheckAndMutateRowRequest;
use Google\Cloud\Bigtable\V2\CheckAndMutateRowResponse;
use Google\Cloud\Bigtable\V2\Client\BigtableClient;
/**
* @param string $formattedTableName Optional. The unique name of the table to which the conditional mutation
* should be applied.
*
* Values are of the form
* `projects/<project>/instances/<instance>/tables/<table>`. Please see
* {@see BigtableClient::tableName()} for help formatting this field.
* @param string $rowKey The key of the row to which the conditional mutation should be
* applied.
*/
function check_and_mutate_row_sample(string $formattedTableName, string $rowKey): void
{
// Create a client.
$bigtableClient = new BigtableClient();
// Prepare the request message.
$request = (new CheckAndMutateRowRequest())
->setTableName($formattedTableName)
->setRowKey($rowKey);
// Call the API and handle any network failures.
try {
/** @var CheckAndMutateRowResponse $response */
$response = $bigtableClient->checkAndMutateRow($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedTableName = BigtableClient::tableName('[PROJECT]', '[INSTANCE]', '[TABLE]');
$rowKey = '...';
check_and_mutate_row_sample($formattedTableName, $rowKey);
}
executeQuery
Executes a BTQL query against a particular Cloud Bigtable instance.
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Bigtable\V2\ExecuteQueryRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ timeoutMillis |
int
Timeout to use for this call. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\ServerStream |
use Google\ApiCore\ApiException;
use Google\ApiCore\ServerStream;
use Google\Cloud\Bigtable\V2\Client\BigtableClient;
use Google\Cloud\Bigtable\V2\ExecuteQueryRequest;
use Google\Cloud\Bigtable\V2\ExecuteQueryResponse;
/**
* @param string $formattedInstanceName The unique name of the instance against which the query should be
* executed.
* Values are of the form `projects/<project>/instances/<instance>`
* Please see {@see BigtableClient::instanceName()} for help formatting this field.
* @param string $query The query string.
*/
function execute_query_sample(string $formattedInstanceName, string $query): void
{
// Create a client.
$bigtableClient = new BigtableClient();
// Prepare the request message.
$params = [];
$request = (new ExecuteQueryRequest())
->setInstanceName($formattedInstanceName)
->setQuery($query)
->setParams($params);
// Call the API and handle any network failures.
try {
/** @var ServerStream $stream */
$stream = $bigtableClient->executeQuery($request);
/** @var ExecuteQueryResponse $element */
foreach ($stream->readAll() as $element) {
printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedInstanceName = BigtableClient::instanceName('[PROJECT]', '[INSTANCE]');
$query = '[QUERY]';
execute_query_sample($formattedInstanceName, $query);
}
generateInitialChangeStreamPartitions
NOTE: This API is intended to be used by Apache Beam BigtableIO.
Returns the current list of partitions that make up the table's
change stream. The union of partitions will cover the entire keyspace.
Partitions can be read with ReadChangeStream
.
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Bigtable\V2\GenerateInitialChangeStreamPartitionsRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ timeoutMillis |
int
Timeout to use for this call. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\ServerStream |
use Google\ApiCore\ApiException;
use Google\ApiCore\ServerStream;
use Google\Cloud\Bigtable\V2\Client\BigtableClient;
use Google\Cloud\Bigtable\V2\GenerateInitialChangeStreamPartitionsRequest;
use Google\Cloud\Bigtable\V2\GenerateInitialChangeStreamPartitionsResponse;
/**
* @param string $formattedTableName The unique name of the table from which to get change stream
* partitions. Values are of the form
* `projects/<project>/instances/<instance>/tables/<table>`.
* Change streaming must be enabled on the table. Please see
* {@see BigtableClient::tableName()} for help formatting this field.
*/
function generate_initial_change_stream_partitions_sample(string $formattedTableName): void
{
// Create a client.
$bigtableClient = new BigtableClient();
// Prepare the request message.
$request = (new GenerateInitialChangeStreamPartitionsRequest())
->setTableName($formattedTableName);
// Call the API and handle any network failures.
try {
/** @var ServerStream $stream */
$stream = $bigtableClient->generateInitialChangeStreamPartitions($request);
/** @var GenerateInitialChangeStreamPartitionsResponse $element */
foreach ($stream->readAll() as $element) {
printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedTableName = BigtableClient::tableName('[PROJECT]', '[INSTANCE]', '[TABLE]');
generate_initial_change_stream_partitions_sample($formattedTableName);
}
mutateRow
Mutates a row atomically. Cells already present in the row are left
unchanged unless explicitly changed by mutation
.
The async variant is BigtableClient::mutateRowAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Bigtable\V2\MutateRowRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\Bigtable\V2\MutateRowResponse |
use Google\ApiCore\ApiException;
use Google\Cloud\Bigtable\V2\Client\BigtableClient;
use Google\Cloud\Bigtable\V2\MutateRowRequest;
use Google\Cloud\Bigtable\V2\MutateRowResponse;
use Google\Cloud\Bigtable\V2\Mutation;
/**
* @param string $formattedTableName Optional. The unique name of the table to which the mutation should be
* applied.
*
* Values are of the form
* `projects/<project>/instances/<instance>/tables/<table>`. Please see
* {@see BigtableClient::tableName()} for help formatting this field.
* @param string $rowKey The key of the row to which the mutation should be applied.
*/
function mutate_row_sample(string $formattedTableName, string $rowKey): void
{
// Create a client.
$bigtableClient = new BigtableClient();
// Prepare the request message.
$mutations = [new Mutation()];
$request = (new MutateRowRequest())
->setTableName($formattedTableName)
->setRowKey($rowKey)
->setMutations($mutations);
// Call the API and handle any network failures.
try {
/** @var MutateRowResponse $response */
$response = $bigtableClient->mutateRow($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedTableName = BigtableClient::tableName('[PROJECT]', '[INSTANCE]', '[TABLE]');
$rowKey = '...';
mutate_row_sample($formattedTableName, $rowKey);
}
mutateRows
Mutates multiple rows in a batch. Each individual row is mutated atomically as in MutateRow, but the entire batch is not executed atomically.
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Bigtable\V2\MutateRowsRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ timeoutMillis |
int
Timeout to use for this call. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\ServerStream |
use Google\ApiCore\ApiException;
use Google\ApiCore\ServerStream;
use Google\Cloud\Bigtable\V2\Client\BigtableClient;
use Google\Cloud\Bigtable\V2\MutateRowsRequest;
use Google\Cloud\Bigtable\V2\MutateRowsRequest\Entry;
use Google\Cloud\Bigtable\V2\MutateRowsResponse;
use Google\Cloud\Bigtable\V2\Mutation;
/**
* @param string $formattedTableName Optional. The unique name of the table to which the mutations should be
* applied.
*
* Values are of the form
* `projects/<project>/instances/<instance>/tables/<table>`. Please see
* {@see BigtableClient::tableName()} for help formatting this field.
*/
function mutate_rows_sample(string $formattedTableName): void
{
// Create a client.
$bigtableClient = new BigtableClient();
// Prepare the request message.
$entriesMutations = [new Mutation()];
$entry = (new Entry())
->setMutations($entriesMutations);
$entries = [$entry,];
$request = (new MutateRowsRequest())
->setTableName($formattedTableName)
->setEntries($entries);
// Call the API and handle any network failures.
try {
/** @var ServerStream $stream */
$stream = $bigtableClient->mutateRows($request);
/** @var MutateRowsResponse $element */
foreach ($stream->readAll() as $element) {
printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedTableName = BigtableClient::tableName('[PROJECT]', '[INSTANCE]', '[TABLE]');
mutate_rows_sample($formattedTableName);
}
pingAndWarm
Warm up associated instance metadata for this connection.
This call is not required but may be useful for connection keep-alive.
The async variant is BigtableClient::pingAndWarmAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Bigtable\V2\PingAndWarmRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\Bigtable\V2\PingAndWarmResponse |
use Google\ApiCore\ApiException;
use Google\Cloud\Bigtable\V2\Client\BigtableClient;
use Google\Cloud\Bigtable\V2\PingAndWarmRequest;
use Google\Cloud\Bigtable\V2\PingAndWarmResponse;
/**
* @param string $formattedName The unique name of the instance to check permissions for as well
* as respond. Values are of the form
* `projects/<project>/instances/<instance>`. Please see
* {@see BigtableClient::instanceName()} for help formatting this field.
*/
function ping_and_warm_sample(string $formattedName): void
{
// Create a client.
$bigtableClient = new BigtableClient();
// Prepare the request message.
$request = (new PingAndWarmRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var PingAndWarmResponse $response */
$response = $bigtableClient->pingAndWarm($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = BigtableClient::instanceName('[PROJECT]', '[INSTANCE]');
ping_and_warm_sample($formattedName);
}
readChangeStream
NOTE: This API is intended to be used by Apache Beam BigtableIO.
Reads changes from a table's change stream. Changes will reflect both user-initiated mutations and mutations that are caused by garbage collection.
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Bigtable\V2\ReadChangeStreamRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ timeoutMillis |
int
Timeout to use for this call. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\ServerStream |
use Google\ApiCore\ApiException;
use Google\ApiCore\ServerStream;
use Google\Cloud\Bigtable\V2\Client\BigtableClient;
use Google\Cloud\Bigtable\V2\ReadChangeStreamRequest;
use Google\Cloud\Bigtable\V2\ReadChangeStreamResponse;
/**
* @param string $formattedTableName The unique name of the table from which to read a change stream.
* Values are of the form
* `projects/<project>/instances/<instance>/tables/<table>`.
* Change streaming must be enabled on the table. Please see
* {@see BigtableClient::tableName()} for help formatting this field.
*/
function read_change_stream_sample(string $formattedTableName): void
{
// Create a client.
$bigtableClient = new BigtableClient();
// Prepare the request message.
$request = (new ReadChangeStreamRequest())
->setTableName($formattedTableName);
// Call the API and handle any network failures.
try {
/** @var ServerStream $stream */
$stream = $bigtableClient->readChangeStream($request);
/** @var ReadChangeStreamResponse $element */
foreach ($stream->readAll() as $element) {
printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedTableName = BigtableClient::tableName('[PROJECT]', '[INSTANCE]', '[TABLE]');
read_change_stream_sample($formattedTableName);
}
readModifyWriteRow
Modifies a row atomically on the server. The method reads the latest existing timestamp and value from the specified columns and writes a new entry based on pre-defined read/modify/write rules. The new value for the timestamp is the greater of the existing timestamp or the current server time. The method returns the new contents of all modified cells.
The async variant is BigtableClient::readModifyWriteRowAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Bigtable\V2\ReadModifyWriteRowRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\Bigtable\V2\ReadModifyWriteRowResponse |
use Google\ApiCore\ApiException;
use Google\Cloud\Bigtable\V2\Client\BigtableClient;
use Google\Cloud\Bigtable\V2\ReadModifyWriteRowRequest;
use Google\Cloud\Bigtable\V2\ReadModifyWriteRowResponse;
use Google\Cloud\Bigtable\V2\ReadModifyWriteRule;
/**
* @param string $formattedTableName Optional. The unique name of the table to which the read/modify/write rules
* should be applied.
*
* Values are of the form
* `projects/<project>/instances/<instance>/tables/<table>`. Please see
* {@see BigtableClient::tableName()} for help formatting this field.
* @param string $rowKey The key of the row to which the read/modify/write rules should be
* applied.
*/
function read_modify_write_row_sample(string $formattedTableName, string $rowKey): void
{
// Create a client.
$bigtableClient = new BigtableClient();
// Prepare the request message.
$rules = [new ReadModifyWriteRule()];
$request = (new ReadModifyWriteRowRequest())
->setTableName($formattedTableName)
->setRowKey($rowKey)
->setRules($rules);
// Call the API and handle any network failures.
try {
/** @var ReadModifyWriteRowResponse $response */
$response = $bigtableClient->readModifyWriteRow($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedTableName = BigtableClient::tableName('[PROJECT]', '[INSTANCE]', '[TABLE]');
$rowKey = '...';
read_modify_write_row_sample($formattedTableName, $rowKey);
}
readRows
Streams back the contents of all requested rows in key order, optionally applying the same Reader filter to each. Depending on their size, rows and cells may be broken up across multiple responses, but atomicity of each row will still be preserved. See the ReadRowsResponse documentation for details.
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Bigtable\V2\ReadRowsRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ timeoutMillis |
int
Timeout to use for this call. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\ServerStream |
use Google\ApiCore\ApiException;
use Google\ApiCore\ServerStream;
use Google\Cloud\Bigtable\V2\Client\BigtableClient;
use Google\Cloud\Bigtable\V2\ReadRowsRequest;
use Google\Cloud\Bigtable\V2\ReadRowsResponse;
/**
* @param string $formattedTableName Optional. The unique name of the table from which to read.
*
* Values are of the form
* `projects/<project>/instances/<instance>/tables/<table>`. Please see
* {@see BigtableClient::tableName()} for help formatting this field.
*/
function read_rows_sample(string $formattedTableName): void
{
// Create a client.
$bigtableClient = new BigtableClient();
// Prepare the request message.
$request = (new ReadRowsRequest())
->setTableName($formattedTableName);
// Call the API and handle any network failures.
try {
/** @var ServerStream $stream */
$stream = $bigtableClient->readRows($request);
/** @var ReadRowsResponse $element */
foreach ($stream->readAll() as $element) {
printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedTableName = BigtableClient::tableName('[PROJECT]', '[INSTANCE]', '[TABLE]');
read_rows_sample($formattedTableName);
}
sampleRowKeys
Returns a sample of row keys in the table. The returned row keys will delimit contiguous sections of the table of approximately equal size, which can be used to break up the data for distributed tasks like mapreduces.
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Bigtable\V2\SampleRowKeysRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ timeoutMillis |
int
Timeout to use for this call. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\ServerStream |
use Google\ApiCore\ApiException;
use Google\ApiCore\ServerStream;
use Google\Cloud\Bigtable\V2\Client\BigtableClient;
use Google\Cloud\Bigtable\V2\SampleRowKeysRequest;
use Google\Cloud\Bigtable\V2\SampleRowKeysResponse;
/**
* @param string $formattedTableName Optional. The unique name of the table from which to sample row keys.
*
* Values are of the form
* `projects/<project>/instances/<instance>/tables/<table>`. Please see
* {@see BigtableClient::tableName()} for help formatting this field.
*/
function sample_row_keys_sample(string $formattedTableName): void
{
// Create a client.
$bigtableClient = new BigtableClient();
// Prepare the request message.
$request = (new SampleRowKeysRequest())
->setTableName($formattedTableName);
// Call the API and handle any network failures.
try {
/** @var ServerStream $stream */
$stream = $bigtableClient->sampleRowKeys($request);
/** @var SampleRowKeysResponse $element */
foreach ($stream->readAll() as $element) {
printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedTableName = BigtableClient::tableName('[PROJECT]', '[INSTANCE]', '[TABLE]');
sample_row_keys_sample($formattedTableName);
}
checkAndMutateRowAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Bigtable\V2\CheckAndMutateRowRequest
|
optionalArgs |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Bigtable\V2\CheckAndMutateRowResponse> |
mutateRowAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Bigtable\V2\MutateRowRequest
|
optionalArgs |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Bigtable\V2\MutateRowResponse> |
pingAndWarmAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Bigtable\V2\PingAndWarmRequest
|
optionalArgs |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Bigtable\V2\PingAndWarmResponse> |
readModifyWriteRowAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Bigtable\V2\ReadModifyWriteRowRequest
|
optionalArgs |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Bigtable\V2\ReadModifyWriteRowResponse> |
static::authorizedViewName
Formats a string containing the fully-qualified path to represent a authorized_view resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
instance |
string
|
table |
string
|
authorizedView |
string
|
Returns | |
---|---|
Type | Description |
string |
The formatted authorized_view resource. |
static::instanceName
Formats a string containing the fully-qualified path to represent a instance resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
instance |
string
|
Returns | |
---|---|
Type | Description |
string |
The formatted instance resource. |
static::tableName
Formats a string containing the fully-qualified path to represent a table resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
instance |
string
|
table |
string
|
Returns | |
---|---|
Type | Description |
string |
The formatted table resource. |
static::parseName
Parses a formatted name string and returns an associative array of the components in the name.
The following name formats are supported: Template: Pattern
- authorizedView: projects/{project}/instances/{instance}/tables/{table}/authorizedViews/{authorized_view}
- instance: projects/{project}/instances/{instance}
- table: projects/{project}/instances/{instance}/tables/{table}
The optional $template argument can be supplied to specify a particular pattern, and must match one of the templates listed above. If no $template argument is provided, or if the $template argument does not match one of the templates listed, then parseName will check each of the supported templates, and return the first match.
Parameters | |
---|---|
Name | Description |
formattedName |
string
The formatted name string |
template |
?string
Optional name of template to match |
Returns | |
---|---|
Type | Description |
array |
An associative array from name component IDs to component values. |