Connecting using Teradata Python Module on mac

Connectivity
Visitor

Connecting using Teradata Python Module on mac

Hi, I am trying to connect and run a query in Python against Teradata from a mac.

I have installed and I'm trying to use the Teradata Python module 

Here are the calls I'm running:

odbc_lib_path='/usr/lib/libiodbc.dylib'

teradata.UdaExec (appName="TEST", version="1.0",odbcLibPath=odbc_lib_path)
session = udaExec.connect(method="odbc",system="***",username='***', password='***')

However, I am getting the following error:

AttributeError: dlsym(0x1045b58f0, SQLDrivers): symbol not found

Any suggestions ? I also tried specifying 

odbc_lib_path='/Library/Application Support/teradata/client/ODBC/lib/tdata.dylib'

but that didn't work either.

Tags (1)
1 REPLY
Enthusiast

Re: Connecting using Teradata Python Module on mac

Can you try adding logConsole=True to you udaExec call? This may give us an idea on where the process fails.

 

for Eg:-

 

odbc_lib_path='/usr/lib/libiodbc.dylib'
udaExec = teradata.UdaExec (appName="HelloWorld", version="1.0",
        logConsole=True,odbcLibPath=odbc_lib_path)

 

Stdout:

 

$ python2 HelloWorld.py 
2017-01-12 17:04:48,082 - teradata.udaexec - INFO - Initializing UdaExec...
2017-01-12 17:04:48,082 - teradata.udaexec - INFO - Reading config files: [u'/etc/udaexec.ini: Not Found', u'/Users/cravani/udaexec.ini: Not Found', u'/Users/cravani/tdexp/udaexec.ini: Not Found']
2017-01-12 17:04:48,082 - teradata.udaexec - INFO - Found run number file: "/Users/cravani/tdexp/.runNumber"
2017-01-12 17:04:48,082 - teradata.udaexec - INFO - Cleaning up log files older than 90 days.
2017-01-12 17:04:48,082 - teradata.udaexec - INFO - Removed 0 log files.
2017-01-12 17:04:48,102 - teradata.udaexec - INFO - Checkpoint file not found: /Users/cravani/tdexp/HelloWorld.checkpoint
2017-01-12 17:04:48,102 - teradata.udaexec - INFO - No previous checkpoint found, executing from beginning...
2017-01-12 17:04:48,102 - teradata.udaexec - INFO - Execution Details:
/********************************************************************************
 * Application Name: HelloWorld
 *          Version: 1.0
 *       Run Number: 20170112170448-6
 *             Host: HW13603.local
 *         Platform: Darwin-16.3.0-x86_64-i386-64bit
 *          OS User: cravani
 *   Python Version: 2.7.13
 *  Python Compiler: GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)
 *     Python Build: ('default', 'Dec 18 2016 07:03:39')
 *  UdaExec Version: 15.10.0.20
 *     Program Name: HelloWorld.py
 *      Working Dir: /Users/cravani/tdexp
 *          Log Dir: /Users/cravani/tdexp/logs
 *         Log File: /Users/cravani/tdexp/logs/HelloWorld.20170112170448-6.log
 *     Config Files: [u'/etc/udaexec.ini: Not Found', u'/Users/cravani/udaexec.ini: Not Found', u'/Users/cravani/tdexp/udaexec.ini: Not Found']
 *      Query Bands: ApplicationName=HelloWorld;Version=1.0;JobID=20170112170448-6;ClientUser=cravani;Production=False;udaAppLogFile=/Users/cravani/tdexp/logs/HelloWorld.20170112170448-6.log;UtilityName=PyTd;UtilityVersion=15.10.0.20
********************************************************************************/
2017-01-12 17:04:48,110 - teradata.udaexec - INFO - Creating connection: {'username': 'dbc', 'password': 'XXXXXX', 'method': 'odbc', 'system': 'tdexp2'}
2017-01-12 17:04:48,110 - teradata.tdodbc - INFO - Loading ODBC Library: /usr/lib/libiodbc.dylib
2017-01-12 17:04:48,118 - teradata.tdodbc - INFO - Available drivers: Teradata Database ODBC Driver 16.00
2017-01-12 17:04:50,242 - teradata.udaexec - INFO - Connection successful. Duration: 2.132 seconds. Details: {'username': 'dbc', 'password': 'XXXXXX', 'method': 'odbc', 'system': 'tdexp2'}
2017-01-12 17:04:50,243 - teradata.udaexec - INFO - Query Successful. Duration: 0.001 seconds, Rows: 1, Query: SELECT GetQueryBand()
Row 1: [=S> ApplicationName=HelloWorld;Version=1.0;JobID=20170112170448-6;ClientUser=cravani;Production=False;udaAppLogFile=/Users/cravani/tdexp/logs/HelloWorld.20170112170448-6.log;UtilityName=PyTd;UtilityVersion=15.10.0.20;]
2017-01-12 17:04:50,244 - teradata.tdodbc - WARNING - 1 open connections found on exit, attempting to close...
2017-01-12 17:04:50,249 - teradata.udaexec - INFO - UdaExec exiting.

 

 

You may also add logLevel="DEBUG" or  logLevel="TRACE" for more verbose logging and see what may be causing the problem.

 

eg:-

odbc_lib_path='/usr/lib/libiodbc.dylib'
udaExec = teradata.UdaExec (appName="HelloWorld", version="1.0",
        logLevel="TRACE",logConsole=True,odbcLibPath=odbc_lib_path)

 

-Chiran