Skip to content

Commit 25456a7

Browse files
committed
run librarian generate for google-cloud-spanner
1 parent 8d3d808 commit 25456a7

File tree

140 files changed

+891
-217
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

140 files changed

+891
-217
lines changed

.librarian/state.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3246,7 +3246,7 @@ libraries:
32463246
tag_format: '{id}-v{version}'
32473247
- id: google-cloud-spanner
32483248
version: 3.64.0
3249-
last_generated_commit: 64f1dbf504bab7b58ed96a539a5b26a7ebfc65c7
3249+
last_generated_commit: 3e09ac03bab9dba5b8800248cf10190219938a26
32503250
apis:
32513251
- path: google/spanner/admin/instance/v1
32523252
service_config: spanner.yaml

packages/google-cloud-spanner/.flake8

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,29 @@
11
# -*- coding: utf-8 -*-
2-
#
3-
# Copyright 2024 Google LLC
2+
# Copyright 2025 Google LLC
43
#
54
# Licensed under the Apache License, Version 2.0 (the "License");
65
# you may not use this file except in compliance with the License.
76
# You may obtain a copy of the License at
87
#
9-
# https://www.apache.org/licenses/LICENSE-2.0
8+
# http://www.apache.org/licenses/LICENSE-2.0
109
#
1110
# Unless required by applicable law or agreed to in writing, software
1211
# distributed under the License is distributed on an "AS IS" BASIS,
1312
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1413
# See the License for the specific language governing permissions and
1514
# limitations under the License.
16-
17-
# Generated by synthtool. DO NOT EDIT!
15+
#
1816
[flake8]
17+
# TODO(https://github.com/googleapis/gapic-generator-python/issues/2333):
18+
# Resolve flake8 lint issues
1919
ignore = E203, E231, E266, E501, W503
2020
exclude =
21-
# Exclude generated code.
22-
**/proto/**
21+
# TODO(https://github.com/googleapis/gapic-generator-python/issues/2333):
22+
# Ensure that generated code passes flake8 lint
2323
**/gapic/**
2424
**/services/**
2525
**/types/**
26+
# Exclude Protobuf gencode
2627
*_pb2.py
2728

2829
# Standard linting exemptions.

packages/google-cloud-spanner/.repo-metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@
1414
"default_version": "v1",
1515
"codeowner_team": "@googleapis/spanner-team",
1616
"api_shortname": "spanner",
17-
"api_description": "is a fully managed, mission-critical, \nrelational database service that offers transactional consistency at global scale, \nschemas, SQL (ANSI 2011 with extensions), and automatic, synchronous replication \nfor high availability.\n\nBe sure to activate the Cloud Spanner API on the Developer's Console to\nuse Cloud Spanner from your project."
17+
"api_description": "is the world's first fully managed relational database service \nto offer both strong consistency and horizontal scalability for \nmission-critical online transaction processing (OLTP) applications. With Cloud \nSpanner you enjoy all the traditional benefits of a relational database; but \nunlike any other relational database service, Cloud Spanner scales horizontally \nto hundreds or thousands of servers to handle the biggest transactional \nworkloads."
1818
}
Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,20 @@
11
# -*- coding: utf-8 -*-
2-
#
3-
# Copyright 2024 Google LLC
2+
# Copyright 2025 Google LLC
43
#
54
# Licensed under the Apache License, Version 2.0 (the "License");
65
# you may not use this file except in compliance with the License.
76
# You may obtain a copy of the License at
87
#
9-
# https://www.apache.org/licenses/LICENSE-2.0
8+
# http://www.apache.org/licenses/LICENSE-2.0
109
#
1110
# Unless required by applicable law or agreed to in writing, software
1211
# distributed under the License is distributed on an "AS IS" BASIS,
1312
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1413
# See the License for the specific language governing permissions and
1514
# limitations under the License.
16-
17-
# Generated by synthtool. DO NOT EDIT!
15+
#
1816
include README.rst LICENSE
19-
recursive-include google *.json *.proto py.typed
17+
recursive-include google *.py *.pyi *.json *.proto py.typed
2018
recursive-include tests *
2119
global-exclude *.py[co]
2220
global-exclude __pycache__
23-
24-
# Exclude scripts for samples readmegen
25-
prune scripts/readme-gen

packages/google-cloud-spanner/README.rst

Lines changed: 149 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,28 @@
11
Python Client for Cloud Spanner
22
===============================
33

4-
|GA| |pypi| |versions|
5-
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
4+
|stable| |pypi| |versions|
5+
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
1212
workloads.
1313

14-
1514
- `Client Library Documentation`_
1615
- `Product Documentation`_
1716

18-
.. |GA| image:: https://img.shields.io/badge/support-GA-gold.svg
19-
:target: https://github.com/googleapis/google-cloud-python/blob/main/README.rst#general-availability
17+
.. |stable| image:: https://img.shields.io/badge/support-stable-gold.svg
18+
:target: https://github.com/googleapis/google-cloud-python/blob/main/README.rst#stability-levels
2019
.. |pypi| image:: https://img.shields.io/pypi/v/google-cloud-spanner.svg
2120
:target: https://pypi.org/project/google-cloud-spanner/
2221
.. |versions| image:: https://img.shields.io/pypi/pyversions/google-cloud-spanner.svg
2322
:target: https://pypi.org/project/google-cloud-spanner/
24-
.. _Cloud Spanner: https://cloud.google.com/spanner/
25-
.. _Client Library Documentation: https://cloud.google.com/python/docs/reference/spanner/latest
26-
.. _Product Documentation: https://cloud.google.com/spanner/docs
23+
.. _Cloud Spanner: https://cloud.google.com/spanner/docs/
24+
.. _Client Library Documentation: https://cloud.google.com/python/docs/reference/spanner/latest/summary_overview
25+
.. _Product Documentation: https://cloud.google.com/spanner/docs/
2726

2827
Quick Start
2928
-----------
@@ -32,60 +31,74 @@ In order to use this library, you first need to go through the following steps:
3231

3332
1. `Select or create a Cloud Platform project.`_
3433
2. `Enable billing for your project.`_
35-
3. `Enable the Google Cloud Spanner API.`_
36-
4. `Setup Authentication.`_
34+
3. `Enable the Cloud Spanner.`_
35+
4. `Set up Authentication.`_
3736

3837
.. _Select or create a Cloud Platform project.: https://console.cloud.google.com/project
3938
.. _Enable billing for your project.: https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project
40-
.. _Enable the Google Cloud Spanner API.: https://cloud.google.com/spanner
41-
.. _Setup Authentication.: https://googleapis.dev/python/google-api-core/latest/auth.html
39+
.. _Enable the Cloud Spanner.: https://cloud.google.com/spanner/docs/
40+
.. _Set up Authentication.: https://googleapis.dev/python/google-api-core/latest/auth.html
4241

4342
Installation
4443
~~~~~~~~~~~~
4544

46-
Install this library in a `virtualenv`_ using pip. `virtualenv`_ is a tool to
47-
create isolated Python environments. The basic problem it addresses is one of
48-
dependencies and versions, and indirectly permissions.
45+
Install this library in a virtual environment using `venv`_. `venv`_ is a tool that
46+
creates isolated Python environments. These isolated environments can have separate
47+
versions of Python packages, which allows you to isolate one project's dependencies
48+
from the dependencies of other projects.
4949

50-
With `virtualenv`_, it's possible to install this library without needing system
50+
With `venv`_, it's possible to install this library without needing system
5151
install permissions, and without clashing with the installed system
5252
dependencies.
5353

54-
.. _`virtualenv`: https://virtualenv.pypa.io/en/latest/
54+
.. _`venv`: https://docs.python.org/3/library/venv.html
55+
56+
57+
Code samples and snippets
58+
~~~~~~~~~~~~~~~~~~~~~~~~~
59+
60+
Code samples and snippets live in the `samples/`_ folder.
61+
62+
.. _samples/: https://github.com/googleapis/google-cloud-python/tree/main/packages/google-cloud-spanner/samples
5563

5664

5765
Supported Python Versions
5866
^^^^^^^^^^^^^^^^^^^^^^^^^
59-
Python >= 3.9
67+
Our client libraries are compatible with all current `active`_ and `maintenance`_ versions of
68+
Python.
6069

61-
Deprecated Python Versions
62-
^^^^^^^^^^^^^^^^^^^^^^^^^^
63-
Python == 2.7.
64-
Python == 3.5.
65-
Python == 3.6.
66-
Python == 3.7.
67-
Python == 3.8.
70+
Python >= 3.9, including 3.14
71+
72+
.. _active: https://devguide.python.org/devcycle/#in-development-main-branch
73+
.. _maintenance: https://devguide.python.org/devcycle/#maintenance-branches
74+
75+
Unsupported Python Versions
76+
^^^^^^^^^^^^^^^^^^^^^^^^^^^
77+
Python <= 3.8
78+
79+
If you are using an `end-of-life`_
80+
version of Python, we recommend that you update as soon as possible to an actively supported version.
81+
82+
.. _end-of-life: https://devguide.python.org/devcycle/#end-of-life-branches
6883

6984
Mac/Linux
7085
^^^^^^^^^
7186

7287
.. code-block:: console
7388
74-
pip install virtualenv
75-
virtualenv <your-env>
89+
python3 -m venv <your-env>
7690
source <your-env>/bin/activate
77-
<your-env>/bin/pip install google-cloud-spanner
91+
pip install google-cloud-spanner
7892
7993
8094
Windows
8195
^^^^^^^
8296

8397
.. code-block:: console
8498
85-
pip install virtualenv
86-
virtualenv <your-env>
87-
<your-env>\Scripts\activate
88-
<your-env>\Scripts\pip.exe install google-cloud-spanner
99+
py -m venv <your-env>
100+
.\<your-env>\Scripts\activate
101+
pip install google-cloud-spanner
89102
90103
91104
Example Usage
@@ -271,7 +284,101 @@ Auto-retry of aborted transactions is enabled only for ``!autocommit`` mode, as
271284
Next Steps
272285
~~~~~~~~~~
273286

274-
- See the `Client Library Documentation`_ to learn how to connect to Cloud
275-
Spanner using this Client Library.
276-
- Read the `Product documentation`_ to learn
277-
more about the product and see How-to Guides.
287+
- Read the `Client Library Documentation`_ for Cloud Spanner
288+
to see other available methods on the client.
289+
- Read the `Cloud Spanner Product documentation`_ to learn
290+
more about the product and see How-to Guides.
291+
- View this `README`_ to see the full list of Cloud
292+
APIs that we cover.
293+
294+
.. _Cloud Spanner Product documentation: https://cloud.google.com/spanner/docs/
295+
.. _README: https://github.com/googleapis/google-cloud-python/blob/main/README.rst
296+
297+
Logging
298+
-------
299+
300+
This library uses the standard Python :code:`logging` functionality to log some RPC events that could be of interest for debugging and monitoring purposes.
301+
Note the following:
302+
303+
#. 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.
304+
#. 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**.
305+
#. By default, the logging events from this library are not handled. You must **explicitly configure log handling** using one of the mechanisms below.
306+
307+
Simple, environment-based configuration
308+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
309+
310+
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
311+
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
312+
messages in a structured format. It does not currently allow customizing the logging levels captured nor the handlers, formatters, etc. used for any logging
313+
event.
314+
315+
A logging scope is a period-separated namespace that begins with :code:`google`, identifying the Python module or package to log.
316+
317+
- Valid logging scopes: :code:`google`, :code:`google.cloud.asset.v1`, :code:`google.api`, :code:`google.auth`, etc.
318+
- Invalid logging scopes: :code:`foo`, :code:`123`, etc.
319+
320+
**NOTE**: If the logging scope is invalid, the library does not set up any logging handlers.
321+
322+
Environment-Based Examples
323+
^^^^^^^^^^^^^^^^^^^^^^^^^^
324+
325+
- Enabling the default handler for all Google-based loggers
326+
327+
.. code-block:: console
328+
329+
export GOOGLE_SDK_PYTHON_LOGGING_SCOPE=google
330+
331+
- Enabling the default handler for a specific Google module (for a client library called :code:`library_v1`):
332+
333+
.. code-block:: console
334+
335+
export GOOGLE_SDK_PYTHON_LOGGING_SCOPE=google.cloud.library_v1
336+
337+
338+
Advanced, code-based configuration
339+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
340+
341+
You can also configure a valid logging scope using Python's standard `logging` mechanism.
342+
343+
Code-Based Examples
344+
^^^^^^^^^^^^^^^^^^^
345+
346+
- Configuring a handler for all Google-based loggers
347+
348+
.. code-block:: python
349+
350+
import logging
351+
352+
from google.cloud import library_v1
353+
354+
base_logger = logging.getLogger("google")
355+
base_logger.addHandler(logging.StreamHandler())
356+
base_logger.setLevel(logging.DEBUG)
357+
358+
- Configuring a handler for a specific Google module (for a client library called :code:`library_v1`):
359+
360+
.. code-block:: python
361+
362+
import logging
363+
364+
from google.cloud import library_v1
365+
366+
base_logger = logging.getLogger("google.cloud.library_v1")
367+
base_logger.addHandler(logging.StreamHandler())
368+
base_logger.setLevel(logging.DEBUG)
369+
370+
Logging details
371+
~~~~~~~~~~~~~~~
372+
373+
#. 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
374+
logger from the `google`-level logger. If you need the events to be propagated to the root logger, you must explicitly set
375+
:code:`logging.getLogger("google").propagate = True` in your code.
376+
#. You can mix the different logging configurations above for different Google modules. For example, you may want use a code-based logging configuration for
377+
one library, but decide you need to also set up environment-based logging configuration for another library.
378+
379+
#. If you attempt to use both code-based and environment-based configuration for the same module, the environment-based configuration will be ineffectual
380+
if the code -based configuration gets applied first.
381+
382+
#. The Google-specific logging configurations (default handlers for environment-based configuration; not propagating logging events to the root logger) get
383+
executed the first time *any* client library is instantiated in your application, and only if the affected loggers have not been previously configured.
384+
(This is the reason for 2.i. above.)

packages/google-cloud-spanner/docs/README.rst

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)