rogerbinns / apsw

Another Python SQLite wrapper
https://rogerbinns.github.io/apsw/
Other
733 stars 97 forks source link

format_sql_value and float nan/inf/-inf #398

Closed rogerbinns closed 1 year ago

rogerbinns commented 1 year ago

Currently format_sql_value outputs inf for infinity, but SQLite doesn't understand that on import. It will understand 9e999 and treat that as infinity, although postgres retains the full precision.

It should be possible to make a dump of a sqlite database containing these values, and be able to restore it with sqlite.

rogerbinns commented 1 year ago

With a row containing (in Python speak):

    math.inf, -math.inf, math.nan, -0.0

The sqlite shell returns:

    1e999, -1e999, NULL, 0.0