Skip to content

Commit aff66d6

Browse files
sangramqlbillyjacobson
authored andcommitted
Bigtable: Create Instanceadmin sample (GoogleCloudPlatform#1664)
* Python instanceadmin sample instanceadmin python sample * Updated instanceadmin.py * modify instanceadmin as per comments * Update instanceadmin.py as per the local review comments. * Update instanceadmin * update instanceadmin, to fix ci failures. * update instanceadmin * update instanceadmin * Implement review comments
1 parent c5b3a45 commit aff66d6

File tree

4 files changed

+401
-0
lines changed

4 files changed

+401
-0
lines changed

bigtable/instanceadmin/README.rst

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
.. This file is automatically generated. Do not edit this file directly.
2+
3+
4+
Google Cloud Bigtable table creation
5+
===============================================================================
6+
7+
https://cloud.google.com/bigtable/docs/quickstart-cbt
8+
9+
This page explains how to use the cbt command to connect to a Cloud Bigtable instance, perform basic administrative tasks, and read and write data in a table.
10+
11+
Google Cloud Bigtable Python Samples
12+
===============================================================================
13+
14+
.. image:: https://gstatic.com/cloudssh/images/open-btn.png
15+
:target: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/python-docs-samples&page=editor&open_in_editor=bigtable/hello/README.rst
16+
17+
18+
This directory contains samples for Google Cloud Bigtable. `Google Cloud Bigtable`_ is Google's NoSQL Big Data database service. It's the same database that powers many core Google services, including Search, Analytics, Maps, and Gmail.
19+
20+
21+
22+
23+
.. _Google Cloud Bigtable: https://cloud.google.com/bigtable/docs
24+
25+
Setup
26+
-------------------------------------------------------------------------------
27+
28+
29+
Authentication
30+
++++++++++++++
31+
32+
This sample requires you to have authentication setup. Refer to the
33+
`Authentication Getting Started Guide`_ for instructions on setting up
34+
credentials for applications.
35+
36+
.. _Authentication Getting Started Guide:
37+
https://cloud.google.com/docs/authentication/getting-started
38+
39+
Install Dependencies
40+
++++++++++++++++++++
41+
42+
#. Clone python-docs-samples and change directory to the sample directory you want to use.
43+
44+
.. code-block:: bash
45+
46+
$ git clone https://github.com/GoogleCloudPlatform/python-docs-samples.git
47+
48+
#. Install `pip`_ and `virtualenv`_ if you do not already have them. You may want to refer to the `Python Development Environment Setup Guide`_ for Google Cloud Platform for instructions.
49+
50+
.. _Python Development Environment Setup Guide:
51+
https://cloud.google.com/python/setup
52+
53+
#. Create a virtualenv. Samples are compatible with Python 2.7 and 3.4+.
54+
55+
.. code-block:: bash
56+
57+
$ virtualenv env
58+
$ source env/bin/activate
59+
60+
#. Install the dependencies needed to run the samples.
61+
62+
.. code-block:: bash
63+
64+
$ pip install -r requirements.txt
65+
66+
.. _pip: https://pip.pypa.io/
67+
.. _virtualenv: https://virtualenv.pypa.io/
68+
69+
Samples
70+
-------------------------------------------------------------------------------
71+
72+
Basic example
73+
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
74+
75+
.. image:: https://gstatic.com/cloudssh/images/open-btn.png
76+
:target: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/python-docs-samples&page=editor&open_in_editor=bigtable/instanceadmin.py,bigtable/instanceadmin/README.rst
77+
78+
79+
80+
81+
To run this sample:
82+
83+
.. code-block:: bash
84+
85+
$ python instanceadmin.py
86+
87+
usage: instanceadmin.py [-h] [run] [dev-instance] [del-instance] [add-cluster] [del-cluster] project_id instance_id cluster_id
88+
89+
Demonstrates how to connect to Cloud Bigtable and run some basic operations
90+
to create instance, create cluster, delete instance and delete cluster.
91+
Prerequisites: - Create a Cloud Bigtable cluster.
92+
https://cloud.google.com/bigtable/docs/creating-cluster - Set your Google
93+
Application Default Credentials.
94+
https://developers.google.com/identity/protocols/application-default-
95+
credentials
96+
97+
positional arguments:
98+
project_id Your Cloud Platform project ID.
99+
instance_id ID of the Cloud Bigtable instance to connect to.
100+
cluster_id ID of the Cloud Bigtable cluster to connect to.
101+
102+
optional arguments:
103+
-h, --help show this help message and exit
104+
105+
The client library
106+
-------------------------------------------------------------------------------
107+
108+
This sample uses the `Google Cloud Client Library for Python`_.
109+
You can read the documentation for more details on API usage and use GitHub
110+
to `browse the source`_ and `report issues`_.
111+
112+
.. _Google Cloud Client Library for Python:
113+
https://googlecloudplatform.github.io/google-cloud-python/
114+
.. _browse the source:
115+
https://github.com/GoogleCloudPlatform/google-cloud-python
116+
.. _report issues:
117+
https://github.com/GoogleCloudPlatform/google-cloud-python/issues
118+
119+
120+
.. _Google Cloud SDK: https://cloud.google.com/sdk/

bigtable/instanceadmin/README.rst.in

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# This file is used to generate README.rst
2+
3+
product:
4+
name: Google Cloud Bigtable and run some basic operations.
5+
short_name: Cloud Bigtable
6+
url: https://cloud.google.com/bigtable/docs
7+
description: >
8+
`Google Cloud Bigtable`_ is Google's NoSQL Big Data database service. It's
9+
the same database that powers many core Google services, including Search,
10+
Analytics, Maps, and Gmail.
11+
12+
setup:
13+
- auth
14+
- install_deps
15+
16+
samples:
17+
- name: Basic example with Bigtable Column family and GC rules.
18+
file: instanceadmin.py
19+
show_help: true
20+
21+
cloud_client_library: true
22+
23+
folder: bigtable/instanceadmin

0 commit comments

Comments
 (0)