Python's sqlite3.register_converter() does not convert double to Decimal -
Python's sqlite3.register_converter() does not convert double to Decimal -
in sqlite3 there table:
create table t(d double)
in python, code is:
sqlite3.register_converter('double', decimal) ... d, in connection.execute('select d t limit 1'): print type(d)
the printed result is: <type 'float'>
thought why?
connect database using optional argument:
detect_types=sqlite3.parse_decltypes
ie:
conn = sqlite3.connect('database.db', detect_types=sqlite3.parse_decltypes)
then go on have. should work.
see:
http://www.gossamer-threads.com/lists/python/python/627047
python sqlite3
Comments
Post a Comment