Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add PG.OID type cod annotation #1023

Merged
merged 11 commits into from
Oct 30, 2023
12 changes: 6 additions & 6 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ API Documentation
spanner_v1/transaction
spanner_v1/streamed

spanner_v1/services
spanner_v1/types
spanner_admin_database_v1/services
spanner_admin_database_v1/types
spanner_v1/services_
spanner_v1/types_
spanner_admin_database_v1/services_
spanner_admin_database_v1/types_
spanner_admin_database_v1/database_admin
spanner_admin_instance_v1/services
spanner_admin_instance_v1/types
spanner_admin_instance_v1/services_
spanner_admin_instance_v1/types_
spanner_admin_instance_v1/instance_admin


Expand Down
File renamed without changes.
File renamed without changes.
7 changes: 7 additions & 0 deletions google/cloud/spanner_v1/types/type.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,17 @@ class TypeAnnotationCode(proto.Enum):
PostgreSQL JSONB values. Currently this annotation is always
needed for [JSON][google.spanner.v1.TypeCode.JSON] when a
client interacts with PostgreSQL-enabled Spanner databases.
PG_OID (4):
PostgreSQL compatible OID type. This
annotation can be used by a client interacting
with PostgreSQL-enabled Spanner database to
specify that a value should be treated using the
semantics of the OID type.
"""
TYPE_ANNOTATION_CODE_UNSPECIFIED = 0
PG_NUMERIC = 2
PG_JSONB = 3
PG_OID = 4


class Type(proto.Message):
Expand Down
472 changes: 291 additions & 181 deletions tests/unit/gapic/spanner_admin_database_v1/test_database_admin.py

Large diffs are not rendered by default.

108 changes: 56 additions & 52 deletions tests/unit/gapic/spanner_admin_instance_v1/test_instance_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -4838,10 +4838,11 @@ def test_list_instance_configs_rest(request_type):
# Wrap the value into a proper Response obj
response_value = Response()
response_value.status_code = 200
pb_return_value = spanner_instance_admin.ListInstanceConfigsResponse.pb(
# Convert return value to protobuf type
return_value = spanner_instance_admin.ListInstanceConfigsResponse.pb(
return_value
)
json_return_value = json_format.MessageToJson(pb_return_value)
json_return_value = json_format.MessageToJson(return_value)

response_value._content = json_return_value.encode("UTF-8")
req.return_value = response_value
Expand Down Expand Up @@ -4923,10 +4924,11 @@ def test_list_instance_configs_rest_required_fields(
response_value = Response()
response_value.status_code = 200

pb_return_value = spanner_instance_admin.ListInstanceConfigsResponse.pb(
# Convert return value to protobuf type
return_value = spanner_instance_admin.ListInstanceConfigsResponse.pb(
return_value
)
json_return_value = json_format.MessageToJson(pb_return_value)
json_return_value = json_format.MessageToJson(return_value)

response_value._content = json_return_value.encode("UTF-8")
req.return_value = response_value
Expand Down Expand Up @@ -5062,10 +5064,11 @@ def test_list_instance_configs_rest_flattened():
# Wrap the value into a proper Response obj
response_value = Response()
response_value.status_code = 200
pb_return_value = spanner_instance_admin.ListInstanceConfigsResponse.pb(
# Convert return value to protobuf type
return_value = spanner_instance_admin.ListInstanceConfigsResponse.pb(
return_value
)
json_return_value = json_format.MessageToJson(pb_return_value)
json_return_value = json_format.MessageToJson(return_value)
response_value._content = json_return_value.encode("UTF-8")
req.return_value = response_value

Expand Down Expand Up @@ -5196,8 +5199,9 @@ def test_get_instance_config_rest(request_type):
# Wrap the value into a proper Response obj
response_value = Response()
response_value.status_code = 200
pb_return_value = spanner_instance_admin.InstanceConfig.pb(return_value)
json_return_value = json_format.MessageToJson(pb_return_value)
# Convert return value to protobuf type
return_value = spanner_instance_admin.InstanceConfig.pb(return_value)
json_return_value = json_format.MessageToJson(return_value)

response_value._content = json_return_value.encode("UTF-8")
req.return_value = response_value
Expand Down Expand Up @@ -5282,8 +5286,9 @@ def test_get_instance_config_rest_required_fields(
response_value = Response()
response_value.status_code = 200

pb_return_value = spanner_instance_admin.InstanceConfig.pb(return_value)
json_return_value = json_format.MessageToJson(pb_return_value)
# Convert return value to protobuf type
return_value = spanner_instance_admin.InstanceConfig.pb(return_value)
json_return_value = json_format.MessageToJson(return_value)

response_value._content = json_return_value.encode("UTF-8")
req.return_value = response_value
Expand Down Expand Up @@ -5409,8 +5414,9 @@ def test_get_instance_config_rest_flattened():
# Wrap the value into a proper Response obj
response_value = Response()
response_value.status_code = 200
pb_return_value = spanner_instance_admin.InstanceConfig.pb(return_value)
json_return_value = json_format.MessageToJson(pb_return_value)
# Convert return value to protobuf type
return_value = spanner_instance_admin.InstanceConfig.pb(return_value)
json_return_value = json_format.MessageToJson(return_value)
response_value._content = json_return_value.encode("UTF-8")
req.return_value = response_value

Expand Down Expand Up @@ -6299,10 +6305,11 @@ def test_list_instance_config_operations_rest(request_type):
# Wrap the value into a proper Response obj
response_value = Response()
response_value.status_code = 200
pb_return_value = (
spanner_instance_admin.ListInstanceConfigOperationsResponse.pb(return_value)
# Convert return value to protobuf type
return_value = spanner_instance_admin.ListInstanceConfigOperationsResponse.pb(
return_value
)
json_return_value = json_format.MessageToJson(pb_return_value)
json_return_value = json_format.MessageToJson(return_value)

response_value._content = json_return_value.encode("UTF-8")
req.return_value = response_value
Expand Down Expand Up @@ -6385,12 +6392,13 @@ def test_list_instance_config_operations_rest_required_fields(
response_value = Response()
response_value.status_code = 200

pb_return_value = (
# Convert return value to protobuf type
return_value = (
spanner_instance_admin.ListInstanceConfigOperationsResponse.pb(
return_value
)
)
json_return_value = json_format.MessageToJson(pb_return_value)
json_return_value = json_format.MessageToJson(return_value)

response_value._content = json_return_value.encode("UTF-8")
req.return_value = response_value
Expand Down Expand Up @@ -6531,10 +6539,11 @@ def test_list_instance_config_operations_rest_flattened():
# Wrap the value into a proper Response obj
response_value = Response()
response_value.status_code = 200
pb_return_value = (
spanner_instance_admin.ListInstanceConfigOperationsResponse.pb(return_value)
# Convert return value to protobuf type
return_value = spanner_instance_admin.ListInstanceConfigOperationsResponse.pb(
return_value
)
json_return_value = json_format.MessageToJson(pb_return_value)
json_return_value = json_format.MessageToJson(return_value)
response_value._content = json_return_value.encode("UTF-8")
req.return_value = response_value

Expand Down Expand Up @@ -6659,8 +6668,9 @@ def test_list_instances_rest(request_type):
# Wrap the value into a proper Response obj
response_value = Response()
response_value.status_code = 200
pb_return_value = spanner_instance_admin.ListInstancesResponse.pb(return_value)
json_return_value = json_format.MessageToJson(pb_return_value)
# Convert return value to protobuf type
return_value = spanner_instance_admin.ListInstancesResponse.pb(return_value)
json_return_value = json_format.MessageToJson(return_value)

response_value._content = json_return_value.encode("UTF-8")
req.return_value = response_value
Expand Down Expand Up @@ -6743,10 +6753,9 @@ def test_list_instances_rest_required_fields(
response_value = Response()
response_value.status_code = 200

pb_return_value = spanner_instance_admin.ListInstancesResponse.pb(
return_value
)
json_return_value = json_format.MessageToJson(pb_return_value)
# Convert return value to protobuf type
return_value = spanner_instance_admin.ListInstancesResponse.pb(return_value)
json_return_value = json_format.MessageToJson(return_value)

response_value._content = json_return_value.encode("UTF-8")
req.return_value = response_value
Expand Down Expand Up @@ -6882,8 +6891,9 @@ def test_list_instances_rest_flattened():
# Wrap the value into a proper Response obj
response_value = Response()
response_value.status_code = 200
pb_return_value = spanner_instance_admin.ListInstancesResponse.pb(return_value)
json_return_value = json_format.MessageToJson(pb_return_value)
# Convert return value to protobuf type
return_value = spanner_instance_admin.ListInstancesResponse.pb(return_value)
json_return_value = json_format.MessageToJson(return_value)
response_value._content = json_return_value.encode("UTF-8")
req.return_value = response_value

Expand Down Expand Up @@ -7009,8 +7019,9 @@ def test_get_instance_rest(request_type):
# Wrap the value into a proper Response obj
response_value = Response()
response_value.status_code = 200
pb_return_value = spanner_instance_admin.Instance.pb(return_value)
json_return_value = json_format.MessageToJson(pb_return_value)
# Convert return value to protobuf type
return_value = spanner_instance_admin.Instance.pb(return_value)
json_return_value = json_format.MessageToJson(return_value)

response_value._content = json_return_value.encode("UTF-8")
req.return_value = response_value
Expand Down Expand Up @@ -7093,8 +7104,9 @@ def test_get_instance_rest_required_fields(
response_value = Response()
response_value.status_code = 200

pb_return_value = spanner_instance_admin.Instance.pb(return_value)
json_return_value = json_format.MessageToJson(pb_return_value)
# Convert return value to protobuf type
return_value = spanner_instance_admin.Instance.pb(return_value)
json_return_value = json_format.MessageToJson(return_value)

response_value._content = json_return_value.encode("UTF-8")
req.return_value = response_value
Expand Down Expand Up @@ -7219,8 +7231,9 @@ def test_get_instance_rest_flattened():
# Wrap the value into a proper Response obj
response_value = Response()
response_value.status_code = 200
pb_return_value = spanner_instance_admin.Instance.pb(return_value)
json_return_value = json_format.MessageToJson(pb_return_value)
# Convert return value to protobuf type
return_value = spanner_instance_admin.Instance.pb(return_value)
json_return_value = json_format.MessageToJson(return_value)
response_value._content = json_return_value.encode("UTF-8")
req.return_value = response_value

Expand Down Expand Up @@ -8082,8 +8095,7 @@ def test_set_iam_policy_rest(request_type):
# Wrap the value into a proper Response obj
response_value = Response()
response_value.status_code = 200
pb_return_value = return_value
json_return_value = json_format.MessageToJson(pb_return_value)
json_return_value = json_format.MessageToJson(return_value)

response_value._content = json_return_value.encode("UTF-8")
req.return_value = response_value
Expand Down Expand Up @@ -8160,8 +8172,7 @@ def test_set_iam_policy_rest_required_fields(
response_value = Response()
response_value.status_code = 200

pb_return_value = return_value
json_return_value = json_format.MessageToJson(pb_return_value)
json_return_value = json_format.MessageToJson(return_value)

response_value._content = json_return_value.encode("UTF-8")
req.return_value = response_value
Expand Down Expand Up @@ -8290,8 +8301,7 @@ def test_set_iam_policy_rest_flattened():
# Wrap the value into a proper Response obj
response_value = Response()
response_value.status_code = 200
pb_return_value = return_value
json_return_value = json_format.MessageToJson(pb_return_value)
json_return_value = json_format.MessageToJson(return_value)
response_value._content = json_return_value.encode("UTF-8")
req.return_value = response_value

Expand Down Expand Up @@ -8357,8 +8367,7 @@ def test_get_iam_policy_rest(request_type):
# Wrap the value into a proper Response obj
response_value = Response()
response_value.status_code = 200
pb_return_value = return_value
json_return_value = json_format.MessageToJson(pb_return_value)
json_return_value = json_format.MessageToJson(return_value)

response_value._content = json_return_value.encode("UTF-8")
req.return_value = response_value
Expand Down Expand Up @@ -8435,8 +8444,7 @@ def test_get_iam_policy_rest_required_fields(
response_value = Response()
response_value.status_code = 200

pb_return_value = return_value
json_return_value = json_format.MessageToJson(pb_return_value)
json_return_value = json_format.MessageToJson(return_value)

response_value._content = json_return_value.encode("UTF-8")
req.return_value = response_value
Expand Down Expand Up @@ -8557,8 +8565,7 @@ def test_get_iam_policy_rest_flattened():
# Wrap the value into a proper Response obj
response_value = Response()
response_value.status_code = 200
pb_return_value = return_value
json_return_value = json_format.MessageToJson(pb_return_value)
json_return_value = json_format.MessageToJson(return_value)
response_value._content = json_return_value.encode("UTF-8")
req.return_value = response_value

Expand Down Expand Up @@ -8623,8 +8630,7 @@ def test_test_iam_permissions_rest(request_type):
# Wrap the value into a proper Response obj
response_value = Response()
response_value.status_code = 200
pb_return_value = return_value
json_return_value = json_format.MessageToJson(pb_return_value)
json_return_value = json_format.MessageToJson(return_value)

response_value._content = json_return_value.encode("UTF-8")
req.return_value = response_value
Expand Down Expand Up @@ -8704,8 +8710,7 @@ def test_test_iam_permissions_rest_required_fields(
response_value = Response()
response_value.status_code = 200

pb_return_value = return_value
json_return_value = json_format.MessageToJson(pb_return_value)
json_return_value = json_format.MessageToJson(return_value)

response_value._content = json_return_value.encode("UTF-8")
req.return_value = response_value
Expand Down Expand Up @@ -8837,8 +8842,7 @@ def test_test_iam_permissions_rest_flattened():
# Wrap the value into a proper Response obj
response_value = Response()
response_value.status_code = 200
pb_return_value = return_value
json_return_value = json_format.MessageToJson(pb_return_value)
json_return_value = json_format.MessageToJson(return_value)
response_value._content = json_return_value.encode("UTF-8")
req.return_value = response_value

Expand Down
Loading