Class Client (2.18.1)

  Client 
 ( 
 project 
 = 
 None 
 , 
 credentials 
 = 
 None 
 , 
 read_only 
 = 
 False 
 , 
 admin 
 = 
 False 
 , 
 client_info 
 = 
 None 
 , 
 client_options 
 = 
 None 
 , 
 admin_client_options 
 = 
 None 
 , 
 channel 
 = 
 None 
 , 
 ) 
 

Client for interacting with Google Cloud Bigtable API.

Parameters

Name
Description
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
google.auth.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 :data: 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 :const: ADMIN_SCOPE . Defaults to :data: False . :type: client_info: google.api_core.gapic_v1.client_info.ClientInfo

client_options
google.api_core.client_options.ClientOptions or dict

(Optional) Client options used to set user options on the client. API Endpoint should be set through client_options.

admin_client_options
google.api_core.client_options.ClientOptions or dict

(Optional) Client options used to set user options on the client. API Endpoint for admin operations should be set through admin_client_options.

Properties

instance_admin_client

Getter for the gRPC stub used for the Table Admin API.

For example:

.. literalinclude:: snippets.py :start-after: [START bigtable_api_instance_admin_client] :end-before: [END bigtable_api_instance_admin_client] :dedent: 4

Exceptions
Type
Description
`ValueErro
Returns
Type
Description
.bigtable_admin_pb2.BigtableInstanceAdmin
A BigtableInstanceAdmin instance.

project_path

Project name to be used with Instance Admin API.

.. literalinclude:: snippets.py :start-after: [START bigtable_api_project_path] :end-before: [END bigtable_api_project_path] :dedent: 4

The project name is of the form

 `"projects/{project}"` 
Returns
Type
Description
str
Return a fully-qualified project string.

table_admin_client

Getter for the gRPC stub used for the Table Admin API.

For example:

.. literalinclude:: snippets.py :start-after: [START bigtable_api_table_admin_client] :end-before: [END bigtable_api_table_admin_client] :dedent: 4

Exceptions
Type
Description
`ValueErro
Returns
Type
Description
.bigtable_admin_pb2.BigtableTableAdmin
A BigtableTableAdmin instance.

table_data_client

Getter for the gRPC stub used for the Table Admin API.

For example:

.. literalinclude:: snippets.py :start-after: [START bigtable_api_table_data_client] :end-before: [END bigtable_api_table_data_client] :dedent: 4

Returns
Type
Description
.bigtable_v2.BigtableClient
A BigtableClient object.

Methods

instance

  instance 
 ( 
 instance_id 
 , 
 display_name 
 = 
 None 
 , 
 instance_type 
 = 
 None 
 , 
 labels 
 = 
 None 
 ) 
 

Factory to create a instance associated with this client.

For example:

.. literalinclude:: snippets.py :start-after: [START bigtable_api_create_prod_instance] :end-before: [END bigtable_api_create_prod_instance] :dedent: 4

Parameters
Name
Description
instance_id
str

The ID of the instance.

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.

instance_type
int

(Optional) The type of the instance. Possible values are represented by the following constants: :data: google.cloud.bigtable.instance.Instance Type.PRODUCTION . :data: google.cloud.bigtable.instance.InstanceType.DEVELOPMENT , Defaults to :data: google.cloud.bigtable.instance.Instance Type.UNSPECIFIED .

labels
dict

(Optional) Labels are a flexible and lightweight mechanism for organizing cloud resources into groups that reflect a customer's organizational needs and deployment strategies. They can be used to filter resources and aggregate metrics. Label keys must be between 1 and 63 characters long. Maximum 64 labels can be associated with a given resource. Label values must be between 0 and 63 characters long. Keys and values must both be under 128 bytes.

Returns
Type
Description
an instance owned by this client.

list_clusters

  list_clusters 
 () 
 

List the clusters in the project.

For example:

.. literalinclude:: snippets.py :start-after: [START bigtable_api_list_clusters_in_project] :end-before: [END bigtable_api_list_clusters_in_project] :dedent: 4

Returns
Type
Description
tuple
(clusters, failed_locations), where 'clusters' is list of Cluster , and 'failed_locations' is a list of strings representing locations which could not be resolved.

list_instances

  list_instances 
 () 
 

List instances owned by the project.

For example:

.. literalinclude:: snippets.py :start-after: [START bigtable_api_list_instances] :end-before: [END bigtable_api_list_instances] :dedent: 4

Returns
Type
Description
tuple
(instances, failed_locations), where 'instances' is list of Instance , and 'failed_locations' is a list of locations which could not be resolved.
Create a Mobile Website
View Site in Mobile | Classic
Share by: