1
1
# Cloud Bigtable Hello World
2
2
3
3
This is a simple application that demonstrates using the [ Google Cloud Client
4
- Library] [ gcloud-python ] to connect to and interact with Cloud Bigtable.
4
+ Library] [ gcloud-python-bigtable ] to connect to and interact with Cloud Bigtable.
5
5
6
- [ gcloud-python ] : https://github.com/GoogleCloudPlatform/gcloud-python
6
+ <!-- auto-doc-link -->
7
+ These samples are used on the following documentation page:
7
8
9
+ > https://cloud.google.com/bigtable/docs/samples-python-hello
8
10
9
- ## Provision a cluster
11
+ <!-- end-auto-doc-link -->
10
12
11
- Follow the instructions in the [ user documentation] ( https://cloud.google.com/bigtable/docs/creating-cluster )
12
- to create a Google Cloud Platform project and Cloud Bigtable cluster if necessary.
13
- You'll need to reference your project ID, zone and cluster ID to run the application.
13
+ [ gcloud-python-bigtable ] : https://googlecloudplatform.github.io/gcloud-python/stable/bigtable-usage.html
14
+ [ sample-docs ] : https://cloud.google.com/bigtable/docs/samples-python-hello
14
15
15
16
16
- ## Run the application
17
+ <!-- START doctoc generated TOC please keep comment here to allow auto update -->
18
+ <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
19
+ ** Table of Contents**
20
+
21
+ - [ Downloading the sample] ( #downloading-the-sample )
22
+ - [ Costs] ( #costs )
23
+ - [ Provisioning an instance] ( #provisioning-an-instance )
24
+ - [ Running the application] ( #running-the-application )
25
+ - [ Cleaning up] ( #cleaning-up )
26
+
27
+ <!-- END doctoc generated TOC please keep comment here to allow auto update -->
28
+
29
+
30
+ ## Downloading the sample
31
+
32
+ Download the sample app and navigate into the app directory:
33
+
34
+ 1 . Clone the [ Python samples
35
+ repository] ( https://github.com/GoogleCloudPlatform/python-docs-samples ) , to
36
+ your local machine:
37
+
38
+ git clone https://github.com/GoogleCloudPlatform/python-docs-samples.git
39
+
40
+ Alternatively, you can [ download the
41
+ sample] ( https://github.com/GoogleCloudPlatform/python-docs-samples/archive/master.zip )
42
+ as a zip file and extract it.
43
+
44
+ 2 . Change to the sample directory.
45
+
46
+ cd python-docs-samples/bigtable/hello
47
+
48
+
49
+ ## Costs
50
+
51
+ This sample uses billable components of Cloud Platform, including:
52
+
53
+ + Google Cloud Bigtable
54
+
55
+ Use the [ Pricing Calculator] [ bigtable-pricing ] to generate a cost estimate
56
+ based on your projected usage. New Cloud Platform users might be eligible for
57
+ a [ free trial] [ free-trial ] .
58
+
59
+ [ bigtable-pricing ] : https://cloud.google.com/products/calculator/#id=1eb47664-13a2-4be1-9d16-6722902a7572
60
+ [ free-trial ] : https://cloud.google.com/free-trial
61
+
62
+
63
+ ## Provisioning an instance
64
+
65
+ Follow the instructions in the [ user
66
+ documentation] ( https://cloud.google.com/bigtable/docs/creating-instance ) to
67
+ create a Google Cloud Platform project and Cloud Bigtable instance if necessary.
68
+ You'll need to reference your project id and instance id to run the
69
+ application.
70
+
71
+
72
+ ## Running the application
17
73
18
74
First, set your [ Google Application Default Credentials] ( https://developers.google.com/identity/protocols/application-default-credentials )
19
75
@@ -23,20 +79,29 @@ Install the dependencies with pip.
23
79
$ pip install -r requirements.txt
24
80
```
25
81
26
- Run the application. Replace the command-line parameters with values for your cluster .
82
+ Run the application. Replace the command-line parameters with values for your instance .
27
83
28
84
```
29
- $ python main.py my-project my-cluster us-central1-c
85
+ $ python main.py my-project my-instance
30
86
```
31
87
32
88
You will see output resembling the following:
33
89
34
90
```
35
- Create table Hello-Bigtable-1234
91
+ Create table Hello-Bigtable
36
92
Write some greetings to the table
37
93
Scan for all greetings:
38
94
greeting0: Hello World!
39
95
greeting1: Hello Cloud Bigtable!
40
96
greeting2: Hello HappyBase!
41
- Delete table Hello-Bigtable-1234
97
+ Delete table Hello-Bigtable
42
98
```
99
+
100
+
101
+ ## Cleaning up
102
+
103
+ To avoid incurring extra charges to your Google Cloud Platform account, remove
104
+ the resources created for this sample.
105
+
106
+ - [ Delete the Cloud Bigtable
107
+ instance] ( https://cloud.google.com/bigtable/docs/deleting-instance ) .
0 commit comments