Skip to content
Permalink
Browse files
feat: added support for numeric field for python decimal value (#316)
* feat: updated googleapis proto changes for request tags

* feat: added support for numberic for python decimal value

* feat: added support for numberic for python decimal value
  • Loading branch information
vi3k6i5 committed Apr 23, 2021
1 parent 7015fd6 commit 070a1712dc34afb68105194060bb2fe6177fbac5
Showing with 4 additions and 0 deletions.
  1. +1 −0 google/cloud/spanner_dbapi/parse_utils.py
  2. +3 −0 tests/unit/spanner_dbapi/test_parse_utils.py
@@ -37,6 +37,7 @@
datetime.date: spanner.param_types.DATE,
DateStr: spanner.param_types.DATE,
TimestampStr: spanner.param_types.TIMESTAMP,
decimal.Decimal: spanner.param_types.NUMERIC,
}

SPANNER_RESERVED_KEYWORDS = {
@@ -353,6 +353,7 @@ def test_cast_for_spanner(self):
@unittest.skipIf(skip_condition, skip_message)
def test_get_param_types(self):
import datetime
import decimal

from google.cloud.spanner_dbapi.parse_utils import DateStr
from google.cloud.spanner_dbapi.parse_utils import TimestampStr
@@ -369,6 +370,7 @@ def test_get_param_types(self):
"h1": datetime.date(2011, 9, 1),
"i1": b"bytes",
"j1": None,
"k1": decimal.Decimal("3.194387483193242e+19"),
}
want_types = {
"a1": param_types.INT64,
@@ -380,6 +382,7 @@ def test_get_param_types(self):
"g1": param_types.TIMESTAMP,
"h1": param_types.DATE,
"i1": param_types.BYTES,
"k1": param_types.NUMERIC,
}
got_types = get_param_types(params)
self.assertEqual(got_types, want_types)

0 comments on commit 070a171

Please sign in to comment.