Turns out pyodbc
can't gracefully convert all of Netezza's types. The table I was working with had two that are problematic:
- A column of type
NUMERIC(7,2)
- A column of type
NVARCHAR(255)
The NUMERIC
column causes a decimal conversion error on NULL. The NVARCHAR
column returns a utf-16-le encoded string, which is a pain in the ass.
I haven't found a good driver-or-wrapper-level solution yet. This can be hacked by casting types in the SQL statement:
SELECT
foo::FLOAT AS was_numeric
, bar::VARCHAR(255) AS was_nvarchar
I'll post here if I find a lower-level answer.