googleapis / googleapis/google-cloud-python

Investigate if decimal context can be set to match spanner numeric limits

Đang mở
#15,946 1 bình luận 0 reaction 1 người được giao Được @vi3k6i5 nhận Xem trên GitHub
api: spanner priority: p3 type: question
Ngôn ngữ chính
Python
Star
5.4k
Fork
1.8k
Merge trung bình
3 ngày 4 giờ
Pull request đã merge (30 ngày)
122

Mô tả

Since decimalField/numeric support was added in googleapis/python-spanner-django#620 some tests were skipped. One of those tests "db_functions.math.test_degrees.DegreesTests.test_decimal", is failing because spanner numeric fields really aren't precise enough. Computed server-side, [spanner's "degrees"](https://github.com/vi3k6i5/python-spanner-django/blob/ce68f3efb1f1cb3b48222ef4cfa0f79312616fa5/django_spanner/functions.py#L185) isn't almostEqual to Decimal(math.degrees(...)). But what if we changed the precision in the [decimal context](https://docs.python.org/3/library/decimal.html#context-objects)?

Investigate if we can change the decimal context, so that the precision in the context matches [spanner's numeric scale limit](https://cloud.google.com/spanner/docs/data-types#numeric_type) before doing any numeric ops.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.