Client#
Warning
gRPC is required for using the Cloud Bigtable API. As of May 2016,
grpcio is only supported in Python 2.7, so importing
gcloud.bigtable in other versions of Python will fail.
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 aInstance - a
Instanceowns aTable - a
Tableowns aColumnFamily - a
Tableowns aRow(and all the cells in the row)
-
gcloud.bigtable.client.ADMIN_SCOPE= 'https://www.googleapis.com/auth/bigtable.admin'# Scope for interacting with the Cluster Admin and Table Admin APIs.
-
class
gcloud.bigtable.client.Client(project=None, credentials=None, read_only=False, admin=False, user_agent='gcloud-python/0.17.0', timeout_seconds=10)[source]# Bases:
gcloud.client._ClientFactoryMixin,gcloud.client._ClientProjectMixinClient for interacting with Google Cloud Bigtable API.
Note
Since the Cloud Bigtable API requires the gRPC transport, no
httpargument 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 (
OAuth2CredentialsorNoneType) – (Optional) The OAuth2 Credentials to use for this client. If not provided, defaults to the Google Application Default Credentials. - 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. - user_agent (str) – (Optional) The user agent to be used with API request.
Defaults to
DEFAULT_USER_AGENT. - timeout_seconds (int) – Number of seconds for request time-out. If not
passed, defaults to
DEFAULT_TIMEOUT_SECONDS.
Raises: ValueErrorif bothread_onlyandadminareTrue-
copy()[source]# Make a copy of this client.
Copies the local data stored as simple types but does not copy the current state of any open connections with the Cloud Bigtable API.
Return type: ClientReturns: A copy of the current client.
-
credentials# Getter for client’s credentials.
Return type: OAuth2CredentialsReturns: The credentials stored on the client.
-
instance(instance_id, location='see-existing-cluster', display_name=None, serve_nodes=3)[source]# Factory to create a instance associated with this client.
Parameters: - instance_id (str) – The ID of the instance.
- location (string) – location name, in form
projects/<project>/locations/<location>; used to set up the instance’s cluster. - display_name (str) – (Optional) The display name for the instance in the Cloud Console UI. (Must be between 4 and 30 characters.) If this value is not set in the constructor, will fall back to the instance ID.
- serve_nodes (int) – (Optional) The number of nodes in the instance’s cluster; used to set up the instance’s cluster.
Return type: Returns: an instance owned by this client.
-
is_started()[source]# Check if the client has been started.
Return type: bool Returns: Boolean indicating if the client has been started.
-
list_instances()[source]# List instances owned by the project.
Return type: tuple Returns: A pair of results, the first is a list of Instanceobjects returned and the second is a list of strings (the failed locations in the request).
-
project_name# Project name to be used with Instance Admin API.
Note
This property will not change if
projectdoes not, but the return value is not cached.The project name is of the form
"projects/{project}"Return type: str Returns: The project name to be used with the Cloud Bigtable Admin API RPC service.
- project (
-
gcloud.bigtable.client.DATA_API_HOST_V2= 'bigtable.googleapis.com'# Data API request host.
-
gcloud.bigtable.client.DATA_API_PORT_V2= 443# Data API request port.
-
gcloud.bigtable.client.DATA_SCOPE= 'https://www.googleapis.com/auth/bigtable.data'# Scope for reading and writing table data.
-
gcloud.bigtable.client.DEFAULT_TIMEOUT_SECONDS= 10# The default timeout to use for API requests.
-
gcloud.bigtable.client.DEFAULT_USER_AGENT= 'gcloud-python/0.17.0'# The default user agent for API requests.
-
gcloud.bigtable.client.INSTANCE_ADMIN_HOST_V2= 'bigtableadmin.googleapis.com'# Cluster Admin API request host.
-
gcloud.bigtable.client.INSTANCE_ADMIN_PORT_V2= 443# Cluster Admin API request port.
-
gcloud.bigtable.client.READ_ONLY_SCOPE= 'https://www.googleapis.com/auth/bigtable.data.readonly'# Scope for reading table data.
-
gcloud.bigtable.client.TABLE_ADMIN_HOST_V2= 'bigtableadmin.googleapis.com'# Table Admin API request host.
-
gcloud.bigtable.client.TABLE_ADMIN_PORT_V2= 443# Table Admin API request port.