forked from googleapis/python-bigtable
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generate readmes for most service samples [(googleapis#599)](GoogleCl…
- Loading branch information
Jon Wayne Parrott
authored
Oct 24, 2016
1 parent
cc8fb16
commit f6ebc97
Showing
3 changed files
with
156 additions
and
109 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
.. This file is automatically generated. Do not edit this file directly. | ||
Google Cloud Bigtable Python Samples | ||
=============================================================================== | ||
|
||
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. | ||
|
||
|
||
This sample demonstrates using the `Google Cloud Client Library HappyBase | ||
package`_, an implementation of the `HappyBase API`_ to connect to and | ||
interact with Cloud Bigtable. | ||
|
||
.. _Google Cloud Client Library HappyBase package: | ||
https://github.com/GoogleCloudPlatform/google-cloud-python-happybase | ||
.. _HappyBase API: http://happybase.readthedocs.io/en/stable/ | ||
|
||
|
||
.. _Google Cloud Bigtable: https://cloud.google.com/bigtable/docs | ||
|
||
Setup | ||
------------------------------------------------------------------------------- | ||
|
||
|
||
Authentication | ||
++++++++++++++ | ||
|
||
Authentication is typically done through `Application Default Credentials`_, | ||
which means you do not have to change the code to authenticate as long as | ||
your environment has credentials. You have a few options for setting up | ||
authentication: | ||
|
||
#. When running locally, use the `Google Cloud SDK`_ | ||
|
||
.. code-block:: bash | ||
gcloud beta auth application-default login | ||
#. When running on App Engine or Compute Engine, credentials are already | ||
set-up. However, you may need to configure your Compute Engine instance | ||
with `additional scopes`_. | ||
|
||
#. You can create a `Service Account key file`_. This file can be used to | ||
authenticate to Google Cloud Platform services from any environment. To use | ||
the file, set the ``GOOGLE_APPLICATION_CREDENTIALS`` environment variable to | ||
the path to the key file, for example: | ||
|
||
.. code-block:: bash | ||
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/service_account.json | ||
.. _Application Default Credentials: https://cloud.google.com/docs/authentication#getting_credentials_for_server-centric_flow | ||
.. _additional scopes: https://cloud.google.com/compute/docs/authentication#using | ||
.. _Service Account key file: https://developers.google.com/identity/protocols/OAuth2ServiceAccount#creatinganaccount | ||
|
||
Install Dependencies | ||
++++++++++++++++++++ | ||
|
||
#. Install `pip`_ and `virtualenv`_ if you do not already have them. | ||
|
||
#. Create a virtualenv. Samples are compatible with Python 2.7 and 3.4+. | ||
|
||
.. code-block:: bash | ||
$ virtualenv env | ||
$ source env/bin/activate | ||
#. Install the dependencies needed to run the samples. | ||
|
||
.. code-block:: bash | ||
$ pip install -r requirements.txt | ||
.. _pip: https://pip.pypa.io/ | ||
.. _virtualenv: https://virtualenv.pypa.io/ | ||
|
||
Samples | ||
------------------------------------------------------------------------------- | ||
|
||
Basic example | ||
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
|
||
|
||
|
||
To run this sample: | ||
|
||
.. code-block:: bash | ||
$ python main.py | ||
usage: main.py [-h] [--table TABLE] project_id instance_id | ||
Demonstrates how to connect to Cloud Bigtable and run some basic operations. | ||
Prerequisites: - Create a Cloud Bigtable cluster. | ||
https://cloud.google.com/bigtable/docs/creating-cluster - Set your Google | ||
Application Default Credentials. | ||
https://developers.google.com/identity/protocols/application-default- | ||
credentials | ||
positional arguments: | ||
project_id Your Cloud Platform project ID. | ||
instance_id ID of the Cloud Bigtable instance to connect to. | ||
optional arguments: | ||
-h, --help show this help message and exit | ||
--table TABLE Table to create and destroy. (default: Hello-Bigtable) | ||
The client library | ||
------------------------------------------------------------------------------- | ||
|
||
This sample uses the `Google Cloud Client Library for Python`_. | ||
You can read the documentation for more details on API usage and use GitHub | ||
to `browse the source`_ and `report issues`_. | ||
|
||
.. Google Cloud Client Library for Python: | ||
https://googlecloudplatform.github.io/google-cloud-python/ | ||
.. browse the source: | ||
https://github.com/GoogleCloudPlatform/google-cloud-python | ||
.. report issues: | ||
https://github.com/GoogleCloudPlatform/google-cloud-python/issues | ||
.. _Google Cloud SDK: https://cloud.google.com/sdk/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# This file is used to generate README.rst | ||
|
||
product: | ||
name: Google Cloud Bigtable | ||
short_name: Cloud Bigtable | ||
url: https://cloud.google.com/bigtable/docs | ||
description: > | ||
`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. | ||
|
||
description: | | ||
This sample demonstrates using the `Google Cloud Client Library HappyBase | ||
package`_, an implementation of the `HappyBase API`_ to connect to and | ||
interact with Cloud Bigtable. | ||
|
||
.. _Google Cloud Client Library HappyBase package: | ||
https://github.com/GoogleCloudPlatform/google-cloud-python-happybase | ||
.. _HappyBase API: http://happybase.readthedocs.io/en/stable/ | ||
|
||
setup: | ||
- auth | ||
- install_deps | ||
|
||
samples: | ||
- name: Basic example | ||
file: main.py | ||
show_help: true | ||
|
||
cloud_client_library: true |