exasol / pyexasol

Exasol Python driver with low overhead, fast HTTP transport and compression
MIT License
72 stars 39 forks source link

all forms of integers maps to str when using fetch_dict=True #71

Closed MazrimT closed 3 years ago

MazrimT commented 3 years ago

When we use the fetch_dict=True flag then all integers turns into strings. Decimal/float/double seems to work as intended, but not integer, smallint, tinyint, bigint.

From what I can see in the mapper.py document there's nothing specified about any form of integers.

littleK0i commented 3 years ago

fetch_mapper is different from fetch_dict. fetch_dict adds only this line:

        if self.fetch_dict:
            row = dict(zip(self.col_names, row))

In theory, there are no possible type covernsions here.

Also, Exasol does not have real integer data type. All integers are converted and stored as DECIMAL: https://docs.exasol.com/sql_references/data_types/datatypealiases.htm

I suspect, you may have DECIMAL column which is larger than 18 digits. In this case Exasol sends results as string from server, because a lot of programming languages do not support JSON deserialisation to integers larger than 64 bits (8 bytes).

Without the fetch_mapper being specified, PyEXASOL returns exactly what it got from server.

littleK0i commented 3 years ago

Solutions:

I would personally prefer the last solution. Performance will be much better.