Teradata Python Driver (PyTd)
raw JSON → 15.10.0.21 verified Fri May 01 auth: no python maintenance
The official Teradata Python driver (PyTd) for executing SQL against Teradata UDA (Unified Data Architecture). Version 15.10.0.21 supports Teradata Database 15.10+. The library is in maintenance mode; newer applications should consider using the `teradatasql` driver. Release cadence is intermittent.
pip install teradata Common errors
error Error: ('HY000', '[HY000] [Teradata][ODBC Teradata Driver] Not enough memory') ↓
cause Result set too large for ODBC driver buffer; default fetch size is unlimited.
fix
Use
session.execute(query, fetch_size=1000) to limit fetch size. error teradata.api.DatabaseError: (3707, '[Teradata Database] [3932] The user is not a privileged user.') ↓
cause User lacks required privileges (e.g., creating tables, macros).
fix
Grant necessary permissions via Teradata DBA.
error AttributeError: module 'teradata' has no attribute 'UdaExec' ↓
cause Incorrect import; user tried `from teradata import UdaExec`.
fix
Use
import teradata and reference teradata.UdaExec. Warnings
gotcha Default ODBC DSN not configured: The driver requires either a DSN or method='odbc' with system/user/pass. Using method='odbc' without a DSN is common but misconfigured if no Teradata ODBC driver is installed. ↓
fix Install Teradata ODBC driver (Windows) or use method='rest' with REST endpoints (if available).
deprecated Library in maintenance: Teradata recommends using `teradatasql` for new projects. `teradata` (PyTd) is no longer actively developed. ↓
fix Migrate to `pip install teradatasql` and update connection syntax.
gotcha Connection leaks: `execute()` returns a result set that must be closed or fetched entirely; otherwise, subsequent queries may hang. ↓
fix Always iterate or call `.fetchall()` and ensure result set is consumed or closed.
Imports
- udaExec wrong
from teradata import udaExeccorrectimport teradata - teradata.UdaExec wrong
import UdaExeccorrectudaExec = teradata.UdaExec(appName='test')
Quickstart
import teradata
udaExec = teradata.UdaExec(appName='test', version='1.0', logConsole=False)
session = udaExec.connect(method='odbc', system='your_td_host', username=os.environ.get('TD_USER', ''), password=os.environ.get('TD_PASS', ''))
query = "SELECT DATABASENAME FROM DBC.DATABASESV WHERE DATABASENAME = 'DBC'"
df = session.execute(query).fetchall()
print(df)
session.close()