Teradata Python Module

Tools
Tools covers the tools and utilities you use to work with Teradata and its supporting ecosystem. You'll find information on everything from the Teradata Eclipse plug-in to load/extract tools.
Teradata Employee

Re: Teradata Python Module

@ulrich - Note that the working directory is actually the directory you are located in when you execute the script and not necessarily the directory that contains the script.  You can change the location of the checkpoint file and log files using the following configuration.

[CONFIG]
appName=myapp
workingDir=/var/opt/myapp
checkpointFile=${workingDir}/${appName}.checkpoint
logDir=${workingDir}/log

Thanks for the feedback.

Re: Teradata Python Module

I'm trying to use the teradata package and when I try to execute udaExec.connect command, its giving me the below error. I'm using Python 2.7.5 and Mac OS X 10.9.5

My assumption is, system --> Teradata Server Name. I even tried with the default value in the page "tdprod" and getting the same error. So, not sure if Python is connecting with the Teradata Server. I have my Teradata ODBC in my MAC as I connect to the Server using Tableau and Studio Express without issues. Any help? 

Re: Teradata Python Module

I'm trying to use the teradata package and when I try to execute udaExec.connect command, its giving me the below error. I'm using Python 2.7.5 and Mac OS X 10.9.5

My assumption is, system --> Teradata Server Name. I even tried with the default value in the page "tdprod" and getting the same error. So, not sure if Python is connecting with the Teradata Server.

I have my Teradata ODBC 15x in my MAC as I connect to the Server using Tableau and Studio Express without issues. Any help? 

Given below is the error message:

>>> session = udaExec.connect(method="odbc", system="tdprod",username=“user", password=“pswd”)  

Traceback (most recent call last):    

File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/logging/__init__.py", line 874, in emit      

stream.write(fs % msg.encode("UTF-8"))  

UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 207: ordinal not in range(128)  

Logged from file udaexec.py, line 45    

File "<stdin>", line 1

SyntaxError: EOL while scanning string literal

Teradata Employee

Re: Teradata Python Module

@jegan.velappan - I'm not able to reproduce your error using Mac OS X 10.10.2 and Python 2.7.10.  Do you have any non-ascii characters in any of the strings you are passing to UdaExec.connect?  If so, prepending them with "u" e.g. (u"MyString") should fix the problem.  Otherwise, using Python3 should also resolve the problem.

Senior Supporter

Re: Teradata Python Module

@eric thanks for the clarification!

The workaround / the solution worked fine.

Senior Supporter

Re: Teradata Python Module

@eric question - is native JDBC support also on the roadmap? Would have some advantages as it only requires JDBC driver distribution and not ODBC installation for clients who don't use the RestAPI (which is my favorite)...

Teradata Employee

Re: Teradata Python Module

@urlich There are no plans at this time to also support JDBC as a connection option.  If people don't want to install ODBC, then we recommend they use the REST API instead.

Enthusiast

Re: Teradata Python Module

Any idea how to pass parameters to session.executemany from pandas dataframe ?

=I need to load all data from pandas dataframe to teradata table

session.executemany("""INSERT INTO employee (id, firstName, lastName, dob)

                       VALUES (?, ?, ?, ?)""",

                    ((1,"James", "Kirk", "2233-03-22"),

                     (2,"Jean-Luc", "Picard", "2305-07-13")),

                    batch=True)

Enthusiast

Re: Teradata Python Module

Can we utilize Utility sessions like FastExport, FastLoad and MultiLoad like we use in JDBC?

Teradata Employee

Re: Teradata Python Module

 @cr255014 - Unforuntately, no.  The connectivity methods used by the Teradata Python Module  (ODBC/REST) do not support FastExport, FastLoad, or MultiLoad at this time.