Connect Python to Teradata in mac with pyodbc

廉价感情. 提交于 2019-12-01 23:02:40

Basically pyodbc is not straight forward and gives good enough debugging time for developers. Follow the below steps,

You might have done them already, then just verify

  1. Install iodbc for mac http://www.iodbc.org/dataspace/iodbc/wiki/iODBC/Downloads

  2. Install Teradata ODBC Driver for Mac OS X, http://downloads.teradata.com/download/connectivity/teradata-odbc-driver-for-mac-os-x

  3. Also install unixodbc for mac, “brew install unixodbc”

  4. Download pyodbc source and change the setup.py file as below,

 elif sys.platform == 'darwin':
    # OS/X now ships with iODBC.
    settings['libraries'].append('iodbc')
    settings['libraries'].append('odbc')

you will be adding the last line of including “odbc” for build Build and install pyodbc

  1. Setup the traditional LD_LIBRARY_PATH for mac as below ( I used TD version 15.00, you have to point to the one as you installed)

export DYLD_LIBRARY_PATH=/Library/Application\ Support/teradata/client/ODBC/lib:/Library/Application\ Support/teradata/client/15.00/lib/

  1. Export ODBCINI path

export ODBCINI=/Library/Application\ Support/teradata/client/15.00/odbc/odbc.ini

Now pyodbc cursor happily will fetch record sets for you

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!