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

Issues on Ubuntu (works well on CentOS) #70

Open dclong opened 7 years ago

dclong commented 7 years ago

I got the following error using the package on Ubuntu (with Teradata ODBC 16.00 driver installed).

DatabaseError: (0, '[I] [. Check that the ODBC driver is installed and the ODBCINI or ODBCINST environment variables are correctly set.')
  1. I have ODBCINI exported.
  2. pyodbc works well on the same Ubuntu machine.
  3. The Python code and Teradata ODBC configuration works well on a CentOS machine (with Teradata ODBC 16.00 driver installed).

This makes me wondering: does the Teradata package rely on some CentOS specific features (folder structure, configuration file, etc.) to work?

escheie commented 7 years ago

The Teradata Python module loads the "libodbc.so" library without specifying a path. When the Teradata ODBC Driver is installed it copies the Data Direct Driver Manager it ships with to the system path where the Teradata Python module typically finds it. If another driver manager is installed however, such as unixodbc, this may cause the Teradata Python Module to load the wrong Driver Manager, resulting in the error above. You should be able to get past this error by specifying the odbcLibPath option either when initializing UdaExec or in the CONFIG section of your external configuration file with the location of the correct libodbc.so file to load.

dclong commented 7 years ago

@escheie Thank you! I'll have a try to see whether this works on Ubuntu.

dclong commented 7 years ago

@escheie Specifying the odbcLibPath option works for me on Ubuntu! Thank you very much for your help!

dclong commented 7 years ago

@escheie Sorry that I closed the issue too early. The problem hasn't been resolved actually. I didn't realize that I was working in my CentOS docker container.

After specifying the odbcLibPath, I got the following error message. libddicu27.so is in the same directory as libodbc.so.

OSError: libddicu27.so: cannot open shared object file: No such file or directory

I checked files in my CentOS docker container, I don't see the *.so files get copied to a system path. libodbc.so are found at the 2 locations in both my CentOS and Ubuntu docker container.

/opt/teradata/client/16.00/lib64/libodbc.so
/opt/teradata/client/16.00/lib/libodbc.so
escheie commented 7 years ago

Try setting the LD_LIBRARY_PATH environment variable to the location where the Teradata ODBC libraries can be loaded. E.g.

export LD_LIBRARY_PATH=/opt/teradata/client/ODBC_64/lib
dclong commented 7 years ago

@escheie This doesn't work for me. The same error msg shows up.

OSError: libddicu27.so: cannot open shared object file: No such file or directory
escheie commented 7 years ago

Where is libddicu27.so located on your system? You may have to modify the LD_LIBRARY_PATH above to make sure it includes that library.

dclong commented 7 years ago

It's in the same directory as libodbc.so. I've tried different options for LD_LIBRARY_PATH but unfortunately none of them worked.

dclong commented 6 years ago

I seriously think Teradata should prepare a deb for its ODBC driver.