It appears as if decimal values are treated as strings by ibm_db. Small example:
Python 2.7.14 (default, Mar 14 2018, 13:36:31) [GCC 7.3.1 20180303 (Red Hat 7.3.1-5)] on linux2
]$ cat aa.py #!/usr/bin/python import sys import ibm_db conn = ibm_db.connect("dsn=sample","********","********") s1 = ibm_db.prepare(conn, "values (cast(1 as int),cast(0.1 as decimal(2,1)))") ibm_db.execute(s1) d1 = ibm_db.fetch_both(s1) print d1, type(d1), d1, type(d1)
1 <type 'long'> 0.1 <type 'str'>
I'm dumping the dict as JSON to a file (for filebeat -> logstash), so I really need numeric types to stay numeric. I guess I can check the prepared statement for the type (the type is correct there) and massage the data before dumping, but that seems terribly wrong.
Any thoughts on how to get numeric data into the JSON object in the simplest possible way?
I found the following 3 year old mention:
is this limitation still in play?