SQLBot Version
Current main, commit 2ce3fc71ef25a53acea3506589ba47700aae0ccd (1.10.2).
Run Mode
Source code; Python 3.11.11.
Describe the bug
DataFormat.convert_large_numbers_in_object_array() can change the numeric value when formatting floats in scientific notation. The function is used by query results, live chart data and Excel exports.
To Reproduce
In a configured backend development environment, run:
from common.utils.data_format import DataFormat
print(DataFormat.convert_large_numbers_in_object_array([
{"value": 1.23e20},
{"value": 1.23e-10},
]))
Actual result:
[{"value": "1.23E+2"}, {"value": "1.23E-1"}]
Expected behavior
Preserve the original values and return plain decimal strings:
[{"value": "123000000000000000000"}, {"value": "0.000000000123"}]
Additional context
str(Decimal(str(value))) can retain scientific notation. Calling rstrip('0') on that string removes zeros from the exponent. The failure was reproduced by executing the current production function in isolation. Full application endpoints were not exercised.
SQLBot Version
Current
main, commit2ce3fc71ef25a53acea3506589ba47700aae0ccd(1.10.2).Run Mode
Source code; Python 3.11.11.
Describe the bug
DataFormat.convert_large_numbers_in_object_array()can change the numeric value when formatting floats in scientific notation. The function is used by query results, live chart data and Excel exports.To Reproduce
In a configured backend development environment, run:
Actual result:
[{"value": "1.23E+2"}, {"value": "1.23E-1"}]Expected behavior
Preserve the original values and return plain decimal strings:
[{"value": "123000000000000000000"}, {"value": "0.000000000123"}]Additional context
str(Decimal(str(value)))can retain scientific notation. Callingrstrip('0')on that string removes zeros from the exponent. The failure was reproduced by executing the current production function in isolation. Full application endpoints were not exercised.