Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions google/cloud/spanner_v1/param_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
JSON = Type(code=TypeCode.JSON)
PG_NUMERIC = Type(code=TypeCode.NUMERIC, type_annotation=TypeAnnotationCode.PG_NUMERIC)
PG_JSONB = Type(code=TypeCode.JSON, type_annotation=TypeAnnotationCode.PG_JSONB)
PG_OID = Type(code=TypeCode.INT64, type_annotation=TypeAnnotationCode.PG_OID)


def Array(element_type):
Expand Down
12 changes: 12 additions & 0 deletions tests/system/test_session_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -2348,6 +2348,18 @@ def test_execute_sql_w_jsonb_bindings(
)


def test_execute_sql_w_oid_bindings(
not_emulator, not_google_standard_sql, sessions_database, database_dialect
):
_bind_test_helper(
sessions_database,
database_dialect,
spanner_v1.param_types.PG_OID,
123,
[123, 456],
)


def test_execute_sql_w_query_param_struct(sessions_database, not_postgres):
name = "Phred"
count = 123
Expand Down
17 changes: 17 additions & 0 deletions tests/unit/test_param_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,20 @@ def test_it(self):
found = param_types.PG_JSONB

self.assertEqual(found, expected)


class Test_OidParamType(unittest.TestCase):
def test_it(self):
from google.cloud.spanner_v1 import Type
from google.cloud.spanner_v1 import TypeCode
from google.cloud.spanner_v1 import TypeAnnotationCode
from google.cloud.spanner_v1 import param_types

expected = Type(
code=TypeCode.INT64,
type_annotation=TypeAnnotationCode.PG_OID,
)

found = param_types.PG_OID

self.assertEqual(found, expected)