Client
Parent client for calling the Google Cloud Bigtable API.
This is the base from which all interactions with the API occur.
In the hierarchy of API concepts
a
Clientowns anInstancea
Tableowns aColumnFamily
google.cloud.bigtable.client.ADMIN_SCOPE( = 'https://www.googleapis.com/auth/bigtable.admin )
Scope for interacting with the Cluster Admin and Table Admin APIs.
class google.cloud.bigtable.client.Client(project=None, credentials=None, read_only=False, admin=False, client_info=<google.api_core.gapic_v1.client_info.ClientInfo object>, client_options=None, admin_client_options=None, channel=None)
Bases: google.cloud.client.ClientWithProject
Client for interacting with Google Cloud Bigtable API.
NOTE: Since the Cloud Bigtable API requires the gRPC transport, no
_http argument is accepted by this class.
Parameters
project (
strorunicode) – (Optional) The ID of the project which owns the instances, tables and data. If not provided, will attempt to determine from the environment.credentials (
Credentials) – (Optional) The OAuth2 Credentials to use for this client. If not passed, falls back to the default inferred from the environment.read_only (bool) – (Optional) Boolean indicating if the data scope should be for reading only (or for writing as well). Defaults to
False.admin (bool) – (Optional) Boolean indicating if the client will be used to interact with the Instance Admin or Table Admin APIs. This requires the
ADMIN_SCOPE. Defaults toFalse.client_info – The client info used to send a user-agent string along with API requests. If
None, then default info will be used. Generally, you only need to set this if you’re developing your own library or partner tool.client_options (
ClientOptionsordict) – (Optional) Client options used to set user options on the client. API Endpoint should be set through client_options.admin_client_options (
ClientOptionsordict) – (Optional) Client options used to set user options on the client. API Endpoint for admin operations should be set through admin_client_options.(grpc.Channel) (channel) – (Optional) DEPRECATED: A
Channelinstance through which to make calls. This argument is mutually exclusive withcredentials; providing both will raise an exception. No longer used.
Type
client_info:
google.api_core.gapic_v1.client_info.ClientInfoRaises
ValueErrorif bothread_onlyandadminareTrue
instance(instance_id, display_name=None, instance_type=None, labels=None)
Factory to create a instance associated with this client.
For example:
from google.cloud.bigtable import Client
from google.cloud.bigtable import enums
my_instance_id = "inst-my-" + UNIQUE_SUFFIX
my_cluster_id = "clus-my-" + UNIQUE_SUFFIX
location_id = "us-central1-f"
serve_nodes = 1
storage_type = enums.StorageType.SSD
production = enums.Instance.Type.PRODUCTION
labels = {"prod-label": "prod-label"}
client = Client(admin=True)
instance = client.instance(my_instance_id, instance_type=production, labels=labels)
cluster = instance.cluster(
my_cluster_id,
location_id=location_id,
serve_nodes=serve_nodes,
default_storage_type=storage_type,
)
operation = instance.create(clusters=[cluster])
# We want to make sure the operation completes.
operation.result(timeout=100)
Parameters
instance_id (str) – The ID of the instance.
display_name (