|
1 | 1 | Python Client for Cloud Spanner
|
2 | 2 | ===============================
|
3 | 3 |
|
4 |
| - Python idiomatic client for `Cloud Spanner`_. |
| 4 | +|pypi| |versions| |
5 | 5 |
|
6 |
| -.. _Cloud Spanner: https://cloud.google.com/spanner/ |
| 6 | +`Cloud Spanner`_ is the world's first fully managed relational database service |
| 7 | +to offer both strong consistency and horizontal scalability for |
| 8 | +mission-critical online transaction processing (OLTP) applications. With Cloud |
| 9 | +Spanner you enjoy all the traditional benefits of a relational database; but |
| 10 | +unlike any other relational database service, Cloud Spanner scales horizontally |
| 11 | +to hundreds or thousands of servers to handle the biggest transactional |
| 12 | +workloads. |
7 | 13 |
|
8 |
| -|pypi| |versions| |
9 | 14 |
|
10 |
| -- `Documentation`_ |
| 15 | +- `Client Library Documentation`_ |
| 16 | +- `Product Documentation`_ |
11 | 17 |
|
12 |
| -.. _Documentation: https://googlecloudplatform.github.io/google-cloud-python/latest/spanner/usage.html |
| 18 | + |
| 19 | +.. |pypi| image:: https://img.shields.io/pypi/v/google-cloud-spanner.svg |
| 20 | + :target: https://pypi.org/project/google-cloud-spanner/ |
| 21 | +.. |versions| image:: https://img.shields.io/pypi/pyversions/google-cloud-spanner.svg |
| 22 | + :target: https://pypi.org/project/google-cloud-spanner/ |
| 23 | +.. _Cloud Spanner: https://cloud.google.com/spanner/ |
| 24 | +.. _Client Library Documentation: https://googlecloudplatform.github.io/google-cloud-python/latest/spanner/index.html |
| 25 | +.. _Product Documentation: https://cloud.google.com/spanner/docs |
13 | 26 |
|
14 | 27 | Quick Start
|
15 | 28 | -----------
|
16 | 29 |
|
17 |
| -.. code-block:: console |
| 30 | +In order to use this library, you first need to go through the following steps: |
18 | 31 |
|
19 |
| - $ pip install --upgrade google-cloud-spanner |
| 32 | +1. `Select or create a Cloud Platform project.`_ |
| 33 | +2. `Enable billing for your project.`_ |
| 34 | +3. `Enable the Google Cloud Datastore API.`_ |
| 35 | +4. `Setup Authentication.`_ |
20 | 36 |
|
21 |
| -For more information on setting up your Python development environment, |
22 |
| -such as installing ``pip`` and ``virtualenv`` on your system, please refer |
23 |
| -to `Python Development Environment Setup Guide`_ for Google Cloud Platform. |
| 37 | +.. _Select or create a Cloud Platform project.: https://console.cloud.google.com/project |
| 38 | +.. _Enable billing for your project.: https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project |
| 39 | +.. _Enable the Google Cloud Datastore API.: https://cloud.google.com/datastore |
| 40 | +.. _Setup Authentication.: https://googlecloudplatform.github.io/google-cloud-python/latest/core/auth.html |
24 | 41 |
|
25 |
| -.. _Python Development Environment Setup Guide: https://cloud.google.com/python/setup |
| 42 | +Installation |
| 43 | +~~~~~~~~~~~~ |
26 | 44 |
|
| 45 | +Install this library in a `virtualenv`_ using pip. `virtualenv`_ is a tool to |
| 46 | +create isolated Python environments. The basic problem it addresses is one of |
| 47 | +dependencies and versions, and indirectly permissions. |
27 | 48 |
|
28 |
| -Authentication |
29 |
| --------------- |
| 49 | +With `virtualenv`_, it's possible to install this library without needing system |
| 50 | +install permissions, and without clashing with the installed system |
| 51 | +dependencies. |
30 | 52 |
|
31 |
| -With ``google-cloud-python`` we try to make authentication as painless as |
32 |
| -possible. Check out the `Authentication section`_ in our documentation to |
33 |
| -learn more. You may also find the `authentication document`_ shared by all |
34 |
| -the ``google-cloud-*`` libraries to be helpful. |
| 53 | +.. _`virtualenv`: https://virtualenv.pypa.io/en/latest/ |
35 | 54 |
|
36 |
| -.. _Authentication section: https://google-cloud-python.readthedocs.io/en/latest/core/auth.html |
37 |
| -.. _authentication document: https://github.com/GoogleCloudPlatform/google-cloud-common/tree/master/authentication |
38 | 55 |
|
| 56 | +Mac/Linux |
| 57 | +^^^^^^^^^ |
39 | 58 |
|
40 |
| -Using the API |
41 |
| -------------- |
| 59 | +.. code-block:: console |
42 | 60 |
|
43 |
| -Cloud Spanner is the world’s first fully managed relational database service |
44 |
| -to offer both strong consistency and horizontal scalability for |
45 |
| -mission-critical online transaction processing (OLTP) applications. With Cloud |
46 |
| -Spanner you enjoy all the traditional benefits of a relational database; but |
47 |
| -unlike any other relational database service, Cloud Spanner scales |
48 |
| -horizontally to hundreds or thousands of servers to handle the biggest |
49 |
| -transactional workloads. (`About Cloud Spanner`_) |
| 61 | + pip install virtualenv |
| 62 | + virtualenv <your-env> |
| 63 | + source <your-env>/bin/activate |
| 64 | + <your-env>/bin/pip install google-cloud-datastore |
| 65 | +
|
| 66 | +
|
| 67 | +Windows |
| 68 | +^^^^^^^ |
50 | 69 |
|
51 |
| -.. _About Cloud Spanner: https://cloud.google.com/spanner/ |
| 70 | +.. code-block:: console |
| 71 | +
|
| 72 | + pip install virtualenv |
| 73 | + virtualenv <your-env> |
| 74 | + <your-env>\Scripts\activate |
| 75 | + <your-env>\Scripts\pip.exe install google-cloud-datastore |
| 76 | +
|
| 77 | +
|
| 78 | +Example Usage |
| 79 | +------------- |
52 | 80 |
|
53 | 81 |
|
54 | 82 | Executing Arbitrary SQL in a Transaction
|
@@ -152,15 +180,10 @@ if any of the records does not already exist.
|
152 | 180 | )
|
153 | 181 |
|
154 | 182 |
|
155 |
| -Learn More |
156 |
| ----------- |
157 |
| - |
158 |
| -See the ``google-cloud-python`` API `Cloud Spanner documentation`_ to learn how |
159 |
| -to connect to Cloud Spanner using this Client Library. |
| 183 | +Next Steps |
| 184 | +~~~~~~~~~~ |
160 | 185 |
|
161 |
| -.. _Cloud Spanner documentation: https://googlecloudplatform.github.io/google-cloud-python/latest/spanner/usage.html |
162 |
| - |
163 |
| -.. |pypi| image:: https://img.shields.io/pypi/v/google-cloud-spanner.svg |
164 |
| - :target: https://pypi.org/project/google-cloud-spanner/ |
165 |
| -.. |versions| image:: https://img.shields.io/pypi/pyversions/google-cloud-spanner.svg |
166 |
| - :target: https://pypi.org/project/google-cloud-spanner/ |
| 186 | +- See the `Client Library Documentation`_ to learn how to connect to Cloud |
| 187 | + Spanner using this Client Library. |
| 188 | +- Read the `Product documentation`_ to learn |
| 189 | + more about the product and see How-to Guides. |
0 commit comments