Python connect to Teradata in AWS EC2
<p>I want to pull data from a Teradata instance. Client code runs Python2.7+ on AWS EC2 instance.</p>

<p>I installed unixODBC driver and <code>sudo pip install teradata</code> but I am still getting the following exception:</p>

<pre><code>  File "/usr/local/lib/python2.7/site-packages/teradata/tdodbc.py", line 369, in determineDriver
"Available drivers: {}".format(dbType, ",".join(drivers)))
teradata.api.InterfaceError: ('DRIVER_NOT_FOUND', "No driver found for 'Teradata'.  Available drivers: PostgreSQL,MySQL")
</code></pre>

<p>The code is as follows:</p>

<pre><code>import sys
import teradata
# my own imports
td = TeradataClient(DEFAULT_HOSTNAME, DEFAULT_USERNAME, DEFAULT_PASSWORD)
td.select(query, outfile)
</code></pre>

<p>The <code>TeradataClient</code> class I created which calls Teradata is as follows:</p>

<pre><code>class TeradataClient:
    def __init__(self, hostname, username, password):
        self._hostname = hostname
        self._username = username
        self._password = password
        self._udaExec = teradata.UdaExec(appName="MyApp", version="1.0", logConsole=False)


    def select(self, query, outfile, sep=DEFAULT_SEPARATOR, nullstr=DEFAULT_NULL_STR):
        with self._udaExec.connect(method="odbc", system=self._hostname, username=self._username,
                                          password=self._password) as session:
            print 'Connection to Teradata established'
            with open(outfile,'w') as fp:
                with session.cursor() as cursor:
                    for row in cursor.execute(query):
                        lineparts = [str(x if x!=None else nullstr) for x in row]
                        fp.write('%s\n' %sep.join(lineparts))
</code></pre>

<p>How can I fix this? Is there another ODBC driver that needs to be installed?</p>