You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A column with NUMERIC affinity may contain values using all five storage classes. When text data is inserted into a NUMERIC column, the storage class of the text is converted to INTEGER or REAL (in order of preference) if the text is a well-formed integer or real literal, respectively. If the TEXT value is a well-formed integer literal that is too large to fit in a 64-bit signed integer, it is converted to REAL. For conversions between TEXT and REAL storage classes, only the first 15 significant decimal digits of the number are preserved. If the TEXT value is not a well-formed integer or real literal, then the value is stored as TEXT.
Activity
[-]Export failed when Postgres table has numeric(X,0) column[/-][+]Support decimal.Decimal type[/+]simonw commentedon May 10, 2020
It definitely makes sense to me that this library should support
decimal.Decimal.Here are the current supported types:
sqlite-utils/sqlite_utils/db.py
Lines 35 to 55 in 396bee9
Should
decimal.Decimalbe stored as atextorfloatin SQLite I wonder?simonw commentedon May 10, 2020
https://www.sqlite.org/datatype3.html#affinity_name_examples suggests that
DECIMAL(10,5)should be mapped to the SQLite affinity ofNUMERIC- which I've not worked with before.simonw commentedon May 10, 2020
From https://www.sqlite.org/datatype3.html#type_affinity :
simonw commentedon May 10, 2020
sqlite-utilscurrently treats the SQLite NUMERIC concept as a float:sqlite-utils/tests/test_column_affinity.py
Lines 28 to 30 in daf2a24
simonw commentedon May 10, 2020
I'm going to set it up so that Python
decimal.Decimalis treated in a FLOAT column, until someone convinces me otherwise!simonw commentedon May 11, 2020
Released in 2.9 https://sqlite-utils.readthedocs.io/en/latest/changelog.html#v2-9
Support sqlite-utils with decimal fix.