diff --git a/google/cloud/spanner_admin_database_v1/types/spanner_database_admin.py b/google/cloud/spanner_admin_database_v1/types/spanner_database_admin.py index 92f6f58613..b124e628d8 100644 --- a/google/cloud/spanner_admin_database_v1/types/spanner_database_admin.py +++ b/google/cloud/spanner_admin_database_v1/types/spanner_database_admin.py @@ -355,6 +355,26 @@ class CreateDatabaseRequest(proto.Message): database_dialect (google.cloud.spanner_admin_database_v1.types.DatabaseDialect): Optional. The dialect of the Cloud Spanner Database. + proto_descriptors (bytes): + Optional. Proto descriptors used by CREATE/ALTER PROTO + BUNDLE statements in 'extra_statements' above. Contains a + protobuf-serialized + `google.protobuf.FileDescriptorSet `__. + To generate it, + `install `__ and + run ``protoc`` with --include_imports and + --descriptor_set_out. For example, to generate for + moon/shot/app.proto, run + + :: + + $protoc --proto_path=/app_path --proto_path=/lib_path \ + --include_imports \ + --descriptor_set_out=descriptors.data \ + moon/shot/app.proto + + For more details, see protobuffer `self + description `__. """ parent: str = proto.Field( @@ -379,6 +399,10 @@ class CreateDatabaseRequest(proto.Message): number=5, enum=common.DatabaseDialect, ) + proto_descriptors: bytes = proto.Field( + proto.BYTES, + number=6, + ) class CreateDatabaseMetadata(proto.Message): @@ -521,6 +545,25 @@ class UpdateDatabaseDdlRequest(proto.Message): underscore. If the named operation already exists, [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl] returns ``ALREADY_EXISTS``. + proto_descriptors (bytes): + Optional. Proto descriptors used by CREATE/ALTER PROTO + BUNDLE statements. Contains a protobuf-serialized + `google.protobuf.FileDescriptorSet `__. + To generate it, + `install `__ and + run ``protoc`` with --include_imports and + --descriptor_set_out. For example, to generate for + moon/shot/app.proto, run + + :: + + $protoc --proto_path=/app_path --proto_path=/lib_path \ + --include_imports \ + --descriptor_set_out=descriptors.data \ + moon/shot/app.proto + + For more details, see protobuffer `self + description `__. """ database: str = proto.Field( @@ -535,6 +578,10 @@ class UpdateDatabaseDdlRequest(proto.Message): proto.STRING, number=3, ) + proto_descriptors: bytes = proto.Field( + proto.BYTES, + number=4, + ) class DdlStatementActionInfo(proto.Message): @@ -682,12 +729,22 @@ class GetDatabaseDdlResponse(proto.Message): A list of formatted DDL statements defining the schema of the database specified in the request. + proto_descriptors (bytes): + Proto descriptors stored in the database. Contains a + protobuf-serialized + `google.protobuf.FileDescriptorSet `__. + For more details, see protobuffer `self + description `__. """ statements: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=1, ) + proto_descriptors: bytes = proto.Field( + proto.BYTES, + number=2, + ) class ListDatabaseOperationsRequest(proto.Message): diff --git a/google/cloud/spanner_v1/types/type.py b/google/cloud/spanner_v1/types/type.py index c6ead3bf1e..235b851748 100644 --- a/google/cloud/spanner_v1/types/type.py +++ b/google/cloud/spanner_v1/types/type.py @@ -50,6 +50,9 @@ class TypeCode(proto.Enum): FLOAT64 (3): Encoded as ``number``, or the strings ``"NaN"``, ``"Infinity"``, or ``"-Infinity"``. + FLOAT32 (15): + Encoded as ``number``, or the strings ``"NaN"``, + ``"Infinity"``, or ``"-Infinity"``. TIMESTAMP (4): Encoded as ``string`` in RFC 3339 timestamp format. The time zone must be present, and must be ``"Z"``. @@ -104,6 +107,7 @@ class TypeCode(proto.Enum): BOOL = 1 INT64 = 2 FLOAT64 = 3 + FLOAT32 = 15 TIMESTAMP = 4 DATE = 5 STRING = 6 diff --git a/scripts/fixup_spanner_admin_database_v1_keywords.py b/scripts/fixup_spanner_admin_database_v1_keywords.py index b4507f786d..dcba0a2eb4 100644 --- a/scripts/fixup_spanner_admin_database_v1_keywords.py +++ b/scripts/fixup_spanner_admin_database_v1_keywords.py @@ -41,7 +41,7 @@ class spanner_admin_databaseCallTransformer(cst.CSTTransformer): METHOD_TO_PARAMS: Dict[str, Tuple[str]] = { 'copy_backup': ('parent', 'backup_id', 'source_backup', 'expire_time', 'encryption_config', ), 'create_backup': ('parent', 'backup_id', 'backup', 'encryption_config', ), - 'create_database': ('parent', 'create_statement', 'extra_statements', 'encryption_config', 'database_dialect', ), + 'create_database': ('parent', 'create_statement', 'extra_statements', 'encryption_config', 'database_dialect', 'proto_descriptors', ), 'delete_backup': ('name', ), 'drop_database': ('database', ), 'get_backup': ('name', ), @@ -58,7 +58,7 @@ class spanner_admin_databaseCallTransformer(cst.CSTTransformer): 'test_iam_permissions': ('resource', 'permissions', ), 'update_backup': ('backup', 'update_mask', ), 'update_database': ('database', 'update_mask', ), - 'update_database_ddl': ('database', 'statements', 'operation_id', ), + 'update_database_ddl': ('database', 'statements', 'operation_id', 'proto_descriptors', ), } def leave_Call(self, original: cst.Call, updated: cst.Call) -> cst.CSTNode: diff --git a/tests/unit/gapic/spanner_admin_database_v1/test_database_admin.py b/tests/unit/gapic/spanner_admin_database_v1/test_database_admin.py index 48d300b32a..6f9f99b5d1 100644 --- a/tests/unit/gapic/spanner_admin_database_v1/test_database_admin.py +++ b/tests/unit/gapic/spanner_admin_database_v1/test_database_admin.py @@ -2377,6 +2377,7 @@ def test_get_database_ddl(request_type, transport: str = "grpc"): # Designate an appropriate return value for the call. call.return_value = spanner_database_admin.GetDatabaseDdlResponse( statements=["statements_value"], + proto_descriptors=b"proto_descriptors_blob", ) response = client.get_database_ddl(request) @@ -2388,6 +2389,7 @@ def test_get_database_ddl(request_type, transport: str = "grpc"): # Establish that the response is the type that we expect. assert isinstance(response, spanner_database_admin.GetDatabaseDdlResponse) assert response.statements == ["statements_value"] + assert response.proto_descriptors == b"proto_descriptors_blob" def test_get_database_ddl_empty_call(): @@ -2426,6 +2428,7 @@ async def test_get_database_ddl_async( call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( spanner_database_admin.GetDatabaseDdlResponse( statements=["statements_value"], + proto_descriptors=b"proto_descriptors_blob", ) ) response = await client.get_database_ddl(request) @@ -2438,6 +2441,7 @@ async def test_get_database_ddl_async( # Establish that the response is the type that we expect. assert isinstance(response, spanner_database_admin.GetDatabaseDdlResponse) assert response.statements == ["statements_value"] + assert response.proto_descriptors == b"proto_descriptors_blob" @pytest.mark.asyncio @@ -8444,6 +8448,7 @@ def test_get_database_ddl_rest(request_type): # Designate an appropriate value for the returned response. return_value = spanner_database_admin.GetDatabaseDdlResponse( statements=["statements_value"], + proto_descriptors=b"proto_descriptors_blob", ) # Wrap the value into a proper Response obj @@ -8460,6 +8465,7 @@ def test_get_database_ddl_rest(request_type): # Establish that the response is the type that we expect. assert isinstance(response, spanner_database_admin.GetDatabaseDdlResponse) assert response.statements == ["statements_value"] + assert response.proto_descriptors == b"proto_descriptors_blob" def test_get_database_ddl_rest_required_fields(