Skip to content

Commit c347ab3

Browse files
jskeetchalmerlowe
authored andcommitted
chore: complete migration of google-cloud-spanner (#16685)
No changes required other than regeneration. The diffs here are due to reformatting hand-written tests and samples. Fixes googleapis/librarian#5338
1 parent 4ee0414 commit c347ab3

24 files changed

+170
-104
lines changed

librarian.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3501,7 +3501,6 @@ libraries:
35013501
- docs/spanner_v1/table.rst
35023502
- docs/spanner_v1/transaction.rst
35033503
- tests/unit/gapic/conftest.py
3504-
skip_generate: true
35053504
python:
35063505
library_type: GAPIC_COMBO
35073506
opt_args_by_api:
Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
11
{
2-
"name": "spanner",
3-
"name_pretty": "Cloud Spanner",
4-
"product_documentation": "https://cloud.google.com/spanner/docs/",
2+
"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.",
3+
"api_id": "spanner.googleapis.com",
4+
"api_shortname": "spanner",
55
"client_documentation": "https://cloud.google.com/python/docs/reference/spanner/latest",
6+
"default_version": "v1",
7+
"distribution_name": "google-cloud-spanner",
68
"issue_tracker": "https://issuetracker.google.com/issues?q=componentid:190851%2B%20status:open",
7-
"release_level": "stable",
89
"language": "python",
910
"library_type": "GAPIC_COMBO",
10-
"repo": "googleapis/google-cloud-python",
11-
"distribution_name": "google-cloud-spanner",
12-
"api_id": "spanner.googleapis.com",
13-
"requires_billing": true,
14-
"default_version": "v1",
15-
"codeowner_team": "@googleapis/spanner-team",
16-
"api_shortname": "spanner",
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."
18-
}
11+
"name": "spanner",
12+
"name_pretty": "Cloud Spanner",
13+
"product_documentation": "https://cloud.google.com/spanner/docs/",
14+
"release_level": "stable",
15+
"repo": "googleapis/google-cloud-python"
16+
}

packages/google-cloud-spanner/benchmark/benchwrapper/proto/spanner_pb2.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,19 @@
11
# -*- coding: utf-8 -*-
2+
3+
# Copyright 2025 Google LLC
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
217
# Generated by the protocol buffer compiler. DO NOT EDIT!
318
# source: benchmark/benchwrapper/proto/spanner.proto
419
"""Generated protocol buffer code."""

packages/google-cloud-spanner/samples/samples/archived/backup_snippet.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,7 @@ def create_backup_with_encryption_key(
127127
instance_id, database_id, backup_id, kms_key_name
128128
):
129129
"""Creates a backup for a database using a Customer Managed Encryption Key (CMEK)."""
130-
from google.cloud.spanner_admin_database_v1 import \
131-
CreateBackupEncryptionConfig
130+
from google.cloud.spanner_admin_database_v1 import CreateBackupEncryptionConfig
132131

133132
spanner_client = spanner.Client()
134133
instance = spanner_client.instance(instance_id)
@@ -187,8 +186,7 @@ def create_database_with_version_retention_period(
187186
+ " AlbumTitle STRING(MAX)"
188187
+ ") PRIMARY KEY (SingerId, AlbumId),"
189188
+ " INTERLEAVE IN PARENT Singers ON DELETE CASCADE",
190-
"ALTER DATABASE `{}`"
191-
" SET OPTIONS (version_retention_period = '{}')".format(
189+
"ALTER DATABASE `{}` SET OPTIONS (version_retention_period = '{}')".format(
192190
database_id, retention_period
193191
),
194192
]
@@ -396,8 +394,7 @@ def restore_database_with_encryption_key(
396394
instance_id, new_database_id, backup_id, kms_key_name
397395
):
398396
"""Restores a database from a backup using a Customer Managed Encryption Key (CMEK)."""
399-
from google.cloud.spanner_admin_database_v1 import \
400-
RestoreDatabaseEncryptionConfig
397+
from google.cloud.spanner_admin_database_v1 import RestoreDatabaseEncryptionConfig
401398

402399
spanner_client = spanner.Client()
403400
instance = spanner_client.instance(instance_id)

packages/google-cloud-spanner/samples/samples/archived/backup_snippet_test.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,10 @@ def test_create_backup_with_encryption_key(
9191
assert kms_key_name in out
9292

9393

94-
@pytest.mark.skip(reason="same test passes on unarchived test suite, "
95-
"but fails here. Needs investigation")
94+
@pytest.mark.skip(
95+
reason="same test passes on unarchived test suite, "
96+
"but fails here. Needs investigation"
97+
)
9698
@pytest.mark.dependency(depends=["create_backup"])
9799
@RetryErrors(exception=DeadlineExceeded, max_tries=2)
98100
def test_restore_database(capsys, instance_id, sample_database):
@@ -103,8 +105,10 @@ def test_restore_database(capsys, instance_id, sample_database):
103105
assert BACKUP_ID in out
104106

105107

106-
@pytest.mark.skip(reason="same test passes on unarchived test suite, "
107-
"but fails here. Needs investigation")
108+
@pytest.mark.skip(
109+
reason="same test passes on unarchived test suite, "
110+
"but fails here. Needs investigation"
111+
)
108112
@pytest.mark.dependency(depends=["create_backup_with_encryption_key"])
109113
@RetryErrors(exception=DeadlineExceeded, max_tries=2)
110114
def test_restore_database_with_encryption_key(

packages/google-cloud-spanner/samples/samples/archived/pg_samples.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
Spanner PostgreSql dialect.
1919
For more information, see the README.rst under /spanner.
2020
"""
21+
2122
from google.cloud import spanner, spanner_admin_database_v1
2223
from google.cloud.spanner_admin_database_v1.types.common import DatabaseDialect
2324

packages/google-cloud-spanner/samples/samples/archived/pg_samples_test.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@
1717
import pg_samples as samples
1818
import pytest
1919
from google.api_core import exceptions
20-
from google.cloud.spanner_admin_database_v1.types.common import DatabaseDialect
2120
from test_utils.retry import RetryErrors
2221

22+
from google.cloud.spanner_admin_database_v1.types.common import DatabaseDialect
23+
2324
CREATE_TABLE_SINGERS = """\
2425
CREATE TABLE Singers (
2526
SingerId BIGINT NOT NULL,

packages/google-cloud-spanner/samples/samples/archived/samples.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,11 @@
2222

2323
import time
2424

25-
from google.cloud import spanner
2625
from google.iam.v1 import policy_pb2
2726
from google.type import expr_pb2
2827

28+
from google.cloud import spanner
29+
2930
OPERATION_TIMEOUT_SECONDS = 240
3031

3132

@@ -293,8 +294,9 @@ def create_database_with_default_leader(instance_id, database_id, default_leader
293294
AlbumTitle STRING(MAX)
294295
) PRIMARY KEY (SingerId, AlbumId),
295296
INTERLEAVE IN PARENT Singers ON DELETE CASCADE""",
296-
"ALTER DATABASE {}"
297-
" SET OPTIONS (default_leader = '{}')".format(database_id, default_leader),
297+
"ALTER DATABASE {} SET OPTIONS (default_leader = '{}')".format(
298+
database_id, default_leader
299+
),
298300
],
299301
)
300302
operation = database.create()
@@ -806,8 +808,9 @@ def update_database_with_default_leader(instance_id, database_id, default_leader
806808

807809
operation = database.update_ddl(
808810
[
809-
"ALTER DATABASE {}"
810-
" SET OPTIONS (default_leader = '{}')".format(database_id, default_leader)
811+
"ALTER DATABASE {} SET OPTIONS (default_leader = '{}')".format(
812+
database_id, default_leader
813+
)
811814
]
812815
)
813816
operation.result(OPERATION_TIMEOUT_SECONDS)

packages/google-cloud-spanner/samples/samples/archived/samples_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@
2323

2424
import pytest
2525
from google.api_core import exceptions
26-
from google.cloud import spanner
27-
from google.cloud.spanner_admin_database_v1.types.common import DatabaseDialect
2826
from test_utils.retry import RetryErrors
2927

3028
import samples
29+
from google.cloud import spanner
30+
from google.cloud.spanner_admin_database_v1.types.common import DatabaseDialect
3131

3232
CREATE_TABLE_SINGERS = """\
3333
CREATE TABLE Singers (

packages/google-cloud-spanner/samples/samples/autocommit_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
# license that can be found in the LICENSE file or at
55
# https://developers.google.com/open-source/licenses/bsd
66

7-
import pytest
87
from google.api_core.exceptions import Aborted
8+
import pytest
99
from test_utils.retry import RetryErrors
1010

1111
import autocommit

0 commit comments

Comments
 (0)