|
1 | 1 | Python Client for Google Cloud Bigtable |
2 | 2 | ======================================= |
3 | 3 |
|
4 | | -|GA| |pypi| |versions| |
| 4 | +|stable| |pypi| |versions| |
5 | 5 |
|
6 | | -`Google Cloud Bigtable`_ is Google's NoSQL Big Data database service. It's the |
| 6 | +`Google Cloud Bigtable`_: is Google's NoSQL Big Data database service. It's the |
7 | 7 | same database that powers many core Google services, including Search, |
8 | 8 | Analytics, Maps, and Gmail. |
9 | 9 |
|
10 | 10 | - `Client Library Documentation`_ |
11 | 11 | - `Product Documentation`_ |
12 | 12 |
|
13 | | -.. |GA| image:: https://img.shields.io/badge/support-GA-gold.svg |
14 | | - :target: https://github.com/googleapis/google-cloud-python/blob/main/README.rst#general-availability |
| 13 | +.. |stable| image:: https://img.shields.io/badge/support-stable-gold.svg |
| 14 | + :target: https://github.com/googleapis/google-cloud-python/blob/main/README.rst#stability-levels |
15 | 15 | .. |pypi| image:: https://img.shields.io/pypi/v/google-cloud-bigtable.svg |
16 | 16 | :target: https://pypi.org/project/google-cloud-bigtable/ |
17 | 17 | .. |versions| image:: https://img.shields.io/pypi/pyversions/google-cloud-bigtable.svg |
18 | 18 | :target: https://pypi.org/project/google-cloud-bigtable/ |
19 | 19 | .. _Google Cloud Bigtable: https://cloud.google.com/bigtable |
20 | | -.. _Client Library Documentation: https://googleapis.dev/python/bigtable/latest |
| 20 | +.. _Client Library Documentation: https://cloud.google.com/python/docs/reference/bigtable/latest/summary_overview |
21 | 21 | .. _Product Documentation: https://cloud.google.com/bigtable/docs |
22 | 22 |
|
23 | 23 |
|
@@ -51,70 +51,173 @@ In order to use this library, you first need to go through the following steps: |
51 | 51 |
|
52 | 52 | 1. `Select or create a Cloud Platform project.`_ |
53 | 53 | 2. `Enable billing for your project.`_ |
54 | | -3. `Enable the Cloud Bigtable API.`_ |
55 | | -4. `Setup Authentication.`_ |
| 54 | +3. `Enable the Google Cloud Bigtable.`_ |
| 55 | +4. `Set up Authentication.`_ |
56 | 56 |
|
57 | 57 | .. _Select or create a Cloud Platform project.: https://console.cloud.google.com/project |
58 | 58 | .. _Enable billing for your project.: https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project |
59 | | -.. _Enable the Cloud Bigtable API.: https://cloud.google.com/bigtable |
60 | | -.. _Setup Authentication.: https://googleapis.dev/python/google-api-core/latest/auth.html |
| 59 | +.. _Enable the Google Cloud Bigtable.: https://cloud.google.com/bigtable |
| 60 | +.. _Set up Authentication.: https://googleapis.dev/python/google-api-core/latest/auth.html |
61 | 61 |
|
62 | 62 | Installation |
63 | 63 | ~~~~~~~~~~~~ |
64 | 64 |
|
65 | | -Install this library in a `virtualenv`_ using pip. `virtualenv`_ is a tool to |
66 | | -create isolated Python environments. The basic problem it addresses is one of |
67 | | -dependencies and versions, and indirectly permissions. |
| 65 | +Install this library in a virtual environment using `venv`_. `venv`_ is a tool that |
| 66 | +creates isolated Python environments. These isolated environments can have separate |
| 67 | +versions of Python packages, which allows you to isolate one project's dependencies |
| 68 | +from the dependencies of other projects. |
68 | 69 |
|
69 | | -With `virtualenv`_, it's possible to install this library without needing system |
| 70 | +With `venv`_, it's possible to install this library without needing system |
70 | 71 | install permissions, and without clashing with the installed system |
71 | 72 | dependencies. |
72 | 73 |
|
73 | | -.. _`virtualenv`: https://virtualenv.pypa.io/en/latest/ |
| 74 | +.. _`venv`: https://docs.python.org/3/library/venv.html |
| 75 | + |
| 76 | + |
| 77 | +Code samples and snippets |
| 78 | +~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 79 | + |
| 80 | +Code samples and snippets live in the `samples/`_ folder. |
| 81 | + |
| 82 | +.. _samples/: https://github.com/googleapis/google-cloud-python/tree/main/packages/google-cloud-bigtable/samples |
74 | 83 |
|
75 | 84 |
|
76 | 85 | Supported Python Versions |
77 | 86 | ^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 87 | +Our client libraries are compatible with all current `active`_ and `maintenance`_ versions of |
| 88 | +Python. |
78 | 89 |
|
79 | | -Python >= 3.7 |
| 90 | +Python >= 3.9, including 3.14 |
80 | 91 |
|
81 | | -Deprecated Python Versions |
82 | | -^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 92 | +.. _active: https://devguide.python.org/devcycle/#in-development-main-branch |
| 93 | +.. _maintenance: https://devguide.python.org/devcycle/#maintenance-branches |
83 | 94 |
|
84 | | -- Python 2.7: the last released version which supported Python 2.7 was |
85 | | - version 1.7.0, released 2021-02-09. |
| 95 | +Unsupported Python Versions |
| 96 | +^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 97 | +Python <= 3.8 |
86 | 98 |
|
87 | | -- Python 3.5: the last released version which supported Python 3.5 was |
88 | | - version 1.7.0, released 2021-02-09. |
| 99 | +If you are using an `end-of-life`_ |
| 100 | +version of Python, we recommend that you update as soon as possible to an actively supported version. |
89 | 101 |
|
90 | | -- Python 3.6: the last released version which supported Python 3.6 was |
91 | | - version v2.10.1, released 2022-06-03. |
| 102 | +.. _end-of-life: https://devguide.python.org/devcycle/#end-of-life-branches |
92 | 103 |
|
93 | 104 | Mac/Linux |
94 | 105 | ^^^^^^^^^ |
95 | 106 |
|
96 | 107 | .. code-block:: console |
97 | 108 |
|
98 | | - pip install virtualenv |
99 | | - virtualenv <your-env> |
| 109 | + python3 -m venv <your-env> |
100 | 110 | source <your-env>/bin/activate |
101 | | - <your-env>/bin/pip install google-cloud-bigtable |
| 111 | + pip install google-cloud-bigtable |
102 | 112 |
|
103 | 113 |
|
104 | 114 | Windows |
105 | 115 | ^^^^^^^ |
106 | 116 |
|
107 | 117 | .. code-block:: console |
108 | 118 |
|
109 | | - pip install virtualenv |
110 | | - virtualenv <your-env> |
111 | | - <your-env>\Scripts\activate |
112 | | - <your-env>\Scripts\pip.exe install google-cloud-bigtable |
| 119 | + py -m venv <your-env> |
| 120 | + .\<your-env>\Scripts\activate |
| 121 | + pip install google-cloud-bigtable |
113 | 122 |
|
114 | 123 | Next Steps |
115 | 124 | ~~~~~~~~~~ |
116 | 125 |
|
117 | | -- Read the `Client Library Documentation`_ for Cloud Bigtable API |
| 126 | +- Read the `Client Library Documentation`_ for Google Cloud Bigtable |
118 | 127 | to see other available methods on the client. |
119 | | -- Read the `Product documentation`_ to learn |
| 128 | +- Read the `Google Cloud Bigtable Product documentation`_ to learn |
120 | 129 | more about the product and see How-to Guides. |
| 130 | +- View this `README`_ to see the full list of Cloud |
| 131 | + APIs that we cover. |
| 132 | + |
| 133 | +.. _Google Cloud Bigtable Product documentation: https://cloud.google.com/bigtable |
| 134 | +.. _README: https://github.com/googleapis/google-cloud-python/blob/main/README.rst |
| 135 | + |
| 136 | +Logging |
| 137 | +------- |
| 138 | + |
| 139 | +This library uses the standard Python :code:`logging` functionality to log some RPC events that could be of interest for debugging and monitoring purposes. |
| 140 | +Note the following: |
| 141 | + |
| 142 | +#. Logs may contain sensitive information. Take care to **restrict access to the logs** if they are saved, whether it be on local storage or on Google Cloud Logging. |
| 143 | +#. Google may refine the occurrence, level, and content of various log messages in this library without flagging such changes as breaking. **Do not depend on immutability of the logging events**. |
| 144 | +#. By default, the logging events from this library are not handled. You must **explicitly configure log handling** using one of the mechanisms below. |
| 145 | + |
| 146 | +Simple, environment-based configuration |
| 147 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 148 | + |
| 149 | +To enable logging for this library without any changes in your code, set the :code:`GOOGLE_SDK_PYTHON_LOGGING_SCOPE` environment variable to a valid Google |
| 150 | +logging scope. This configures handling of logging events (at level :code:`logging.DEBUG` or higher) from this library in a default manner, emitting the logged |
| 151 | +messages in a structured format. It does not currently allow customizing the logging levels captured nor the handlers, formatters, etc. used for any logging |
| 152 | +event. |
| 153 | + |
| 154 | +A logging scope is a period-separated namespace that begins with :code:`google`, identifying the Python module or package to log. |
| 155 | + |
| 156 | +- Valid logging scopes: :code:`google`, :code:`google.cloud.asset.v1`, :code:`google.api`, :code:`google.auth`, etc. |
| 157 | +- Invalid logging scopes: :code:`foo`, :code:`123`, etc. |
| 158 | + |
| 159 | +**NOTE**: If the logging scope is invalid, the library does not set up any logging handlers. |
| 160 | + |
| 161 | +Environment-Based Examples |
| 162 | +^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 163 | + |
| 164 | +- Enabling the default handler for all Google-based loggers |
| 165 | + |
| 166 | +.. code-block:: console |
| 167 | +
|
| 168 | + export GOOGLE_SDK_PYTHON_LOGGING_SCOPE=google |
| 169 | +
|
| 170 | +- Enabling the default handler for a specific Google module (for a client library called :code:`library_v1`): |
| 171 | + |
| 172 | +.. code-block:: console |
| 173 | +
|
| 174 | + export GOOGLE_SDK_PYTHON_LOGGING_SCOPE=google.cloud.library_v1 |
| 175 | +
|
| 176 | +
|
| 177 | +Advanced, code-based configuration |
| 178 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 179 | + |
| 180 | +You can also configure a valid logging scope using Python's standard `logging` mechanism. |
| 181 | + |
| 182 | +Code-Based Examples |
| 183 | +^^^^^^^^^^^^^^^^^^^ |
| 184 | + |
| 185 | +- Configuring a handler for all Google-based loggers |
| 186 | + |
| 187 | +.. code-block:: python |
| 188 | +
|
| 189 | + import logging |
| 190 | + |
| 191 | + from google.cloud import library_v1 |
| 192 | + |
| 193 | + base_logger = logging.getLogger("google") |
| 194 | + base_logger.addHandler(logging.StreamHandler()) |
| 195 | + base_logger.setLevel(logging.DEBUG) |
| 196 | +
|
| 197 | +- Configuring a handler for a specific Google module (for a client library called :code:`library_v1`): |
| 198 | + |
| 199 | +.. code-block:: python |
| 200 | +
|
| 201 | + import logging |
| 202 | + |
| 203 | + from google.cloud import library_v1 |
| 204 | + |
| 205 | + base_logger = logging.getLogger("google.cloud.library_v1") |
| 206 | + base_logger.addHandler(logging.StreamHandler()) |
| 207 | + base_logger.setLevel(logging.DEBUG) |
| 208 | +
|
| 209 | +Logging details |
| 210 | +~~~~~~~~~~~~~~~ |
| 211 | + |
| 212 | +#. Regardless of which of the mechanisms above you use to configure logging for this library, by default logging events are not propagated up to the root |
| 213 | + logger from the `google`-level logger. If you need the events to be propagated to the root logger, you must explicitly set |
| 214 | + :code:`logging.getLogger("google").propagate = True` in your code. |
| 215 | +#. You can mix the different logging configurations above for different Google modules. For example, you may want use a code-based logging configuration for |
| 216 | + one library, but decide you need to also set up environment-based logging configuration for another library. |
| 217 | + |
| 218 | + #. If you attempt to use both code-based and environment-based configuration for the same module, the environment-based configuration will be ineffectual |
| 219 | + if the code -based configuration gets applied first. |
| 220 | + |
| 221 | +#. The Google-specific logging configurations (default handlers for environment-based configuration; not propagating logging events to the root logger) get |
| 222 | + executed the first time *any* client library is instantiated in your application, and only if the affected loggers have not been previously configured. |
| 223 | + (This is the reason for 2.i. above.) |
0 commit comments