8000 Add Bigtable table admin sample (#1549) · MagicLegends/python-docs-samples@d797d75 · GitHub
[go: up one dir, main page]

Skip to content

Commit d797d75

Browse files
sangramqljabubake
authored andcommitted
Add Bigtable table admin sample (GoogleCloudPlatform#1549)
1 parent 87ce0ff commit d797d75

File tree

5 files changed

+502
-0
lines changed

5 files changed

+502
-0
lines changed

bigtable/tableadmin/README.rst

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

bigtable/tableadmin/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: tableadmin.py
19+
show_help: true
20+
21+
cloud_client_library: true
22+
23+
folder: bigtable/tableadmin

bigtable/tableadmin/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
google-cloud-bigtable==0.29.0

0 commit comments

Comments
 (0)
0