FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

feat: added support for numeric field for python decimal value by vi3k6i5 · Pull Request #316 · googleapis/python-spanner · GitHub

This repository was archived by the owner on Jun 8, 2026. It is now read-only.
/ python-spanner Public archive
1 change: 1 addition & 0 deletions google/cloud/spanner_dbapi/parse_utils.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
3 changes: 3 additions & 0 deletions tests/unit/spanner_dbapi/test_parse_utils.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand All @@ -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)
Expand Down

Back | FazBrowse Home | New Git URL