You will need a Google Cloud Platform (GCP) Project with billing and the Bigtable Admin API enabled. The Cloud Bigtable quickstart covers the necessary steps in detail. Make a note of the GCP Project ID, Instance ID, and Table ID as you will need them below.
These examples are compiled as part of the build for the Cloud Bigtable C++ Client. The instructions on how to compile the code are in the top-level README file. The Bigtable client library quickstart may also be relevant.
On Windows and macOS, gRPC requires an environment variable to find the root of trust for SSL. On macOS use:
curl -Lo roots.pem https://pki.google.com/roots.pem
export GRPC_DEFAULT_SSL_ROOTS_FILE_PATH="$PWD/roots.pem"
While on Windows use:
@powershell -NoProfile -ExecutionPolicy unrestricted -Command ^
(new-object System.Net.WebClient).Downloadfile( ^
'https://pki.google.com/roots.pem', 'roots.pem')
set GRPC_DEFAULT_SSL_ROOTS_FILE_PATH=%cd%\roots.pem
View the Hello World example to see sample usage of the Bigtable client library. More details on this sample code can be found here.
$ ./bigtable_hello_world hello-world <project_id> <instance_id> <table_id>
View the Hello Instance Admin example to see sample usage of instance administration of the Bigtable client library. More details on this sample code can be found here.
Target | Description |
---|---|
./bigtable_hello_instance_admin |
Demonstration of basic operations |
./bigtable_hello_app_profile |
Demonstration of basic operations using App Profile |
./bigtable_instance_admin_snippets |
Collection of individual operations |
Run the above targets with the --help
flag to display the available commands
and their usage. Here is an example of one such command which will create an
instance.
$ ./bigtable_instance_admin_snippets create-instance <project-id> <instance-id> <zone-id>
View the Hello Table Admin example to see sample usage of table administration of the Bigtable client library. More details on this sample code can be found here.
Target | Description |
---|---|
./bigtable_hello_table_admin |
Demonstration of basic operations |
./table_admin_snippets |
Collection of individual operations |
./bigtable_table_admin_backup_snippets |
Collection of Backup operations |
Run the above targets with the --help
flag to display the available commands
and their usage. Here is an example of one such command which will create a
table.
$ ./table_admin_snippets create-table <project-id> <instance-id> <table-id>
Target | Description |
---|---|
./read_snippets |
Collection of synchronous read operations |
./data_snippets |
Collection of other synchronous table operations |
./data_async_snippets |
Collection of asynchronous table operations |
./data_filter_snippets |
Collection of operations using Filters |
The above samples demonstrate individual data operations. Running the targets
with the --help
flag will display the available commands and their usage. Here
is an example of one such command which will read a row from a table.
$ ./read_snippets read-row <project-id> <instance-id> <table-id> <row-key>
The following samples demonstrate use of Authentication and Access Control for Bigtable. More details on the samples can be found here.
Target | Description |
---|---|
./table_admin_iam_policy_snippets |
Examples to interact with IAM policies |
./bigtable_grpc_credentials |
Examples of other types of credentials |
Running the targets with the --help
flag will display the available commands
and their usage. Here is an example of one such command which will output the
IAM Policy for a given table.
$ ./table_admin_iam_policy_snippets get-iam-policy <project-id> <instance-id> <table-id>