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

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, user_agent='google-cloud-python/0.18.0')[source]#

Bases: google.cloud.client._ClientFactoryMixin, google.cloud.client._ClientProjectMixin

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 (str or unicode) – (Optional) The ID of the project which owns the instances, tables and data. If not provided, will attempt to determine from the environment.
  • credentials (OAuth2Credentials or NoneType) – (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 to False.
  • user_agent (str) – (Optional) The user agent to be used with API request. Defaults to DEFAULT_USER_AGENT.
Raises:

ValueError if both read_only and admin are True

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:Client
Returns:A copy of the current client.
credentials#

Getter for client’s credentials.

Return type:OAuth2Credentials
Returns: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:

Instance

Returns:

an instance owned by this client.

list_instances()[source]#

List instances owned by the project.

Return type:tuple
Returns:A pair of results, the first is a list of Instance objects 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 project does 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.
google.cloud.bigtable.client.DATA_API_HOST = 'bigtable.googleapis.com'#

Data API request host.

google.cloud.bigtable.client.DATA_API_PORT = 443#

Data API request port.

google.cloud.bigtable.client.DATA_SCOPE = 'https://www.googleapis.com/auth/bigtable.data'#

Scope for reading and writing table data.

google.cloud.bigtable.client.DEFAULT_USER_AGENT = 'google-cloud-python/0.18.0'#

The default user agent for API requests.

google.cloud.bigtable.client.INSTANCE_ADMIN_HOST = 'bigtableadmin.googleapis.com'#

Cluster Admin API request host.

google.cloud.bigtable.client.INSTANCE_ADMIN_PORT = 443#

Cluster Admin API request port.

google.cloud.bigtable.client.READ_ONLY_SCOPE = 'https://www.googleapis.com/auth/bigtable.data.readonly'#

Scope for reading table data.

google.cloud.bigtable.client.TABLE_ADMIN_HOST = 'bigtableadmin.googleapis.com'#

Table Admin API request host.

google.cloud.bigtable.client.TABLE_ADMIN_PORT = 443#

Table Admin API request port.