Teradata / PyTd

A Python Module to make it easy to script powerful interactions with Teradata Database in a DevOps friendly way.
MIT License
108 stars 43 forks source link

Support for Teradata SIMBA ODBC 16.20 driver + unixODBC? #101

Open padhia opened 6 years ago

padhia commented 6 years ago

Hi,

With 16.20 SIMBA ODBC driver, Teradata officially supports unixODBC driver manager. I am able use Teradata SEN ODBC driver with unixODBC DM using isql and iusql utilities. I can even get pyodbc to work with Python on Linux platform. However following fails

import teradata.tdodbc
conn = teradata.tdodbc.connect(system='dbc', username='xxxxx', password='xxxxxx')

with following error message:

teradata.api.DatabaseError: (0, '[I] [. Check that the ODBC driver is installed and the ODBCINI or ODBCINST environment variables are correctly set.')

setting ODBCINI to point to a valid odbc.ini file doesn't help.

How can I get unixODBC DM to work with teradata python module?

Thanks

escheie commented 6 years ago

It doesn't look like the unixODBC driver manager can be supported without code changes. The DataDirect ODBC driver supported unicode characters via UTF-8 encoding while unixODBC uses UCS2. The disagreement in string encoding causes calls to the unixODBC driver manager to fail.

More investigation is required to see how unixOBDC can be supported. Simply changing create_string_buffer to create_unicode_buffer also failed because python is using UCS4.