{"id":24693,"library":"teradata","title":"Teradata Python Driver (PyTd)","description":"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.","status":"maintenance","version":"15.10.0.21","language":"python","source_language":"en","source_url":"http://github.com/teradata/PyTd","tags":["teradata","database","sql","odbc","maintenance"],"install":[{"cmd":"pip install teradata","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"udaExec is a module attribute, not a direct import; use 'import teradata' then 'teradata.UdaExec'","wrong":"from teradata import udaExec","symbol":"udaExec","correct":"import teradata"},{"note":"'UdaExec' is inside the teradata package; direct import does not work.","wrong":"import UdaExec","symbol":"teradata.UdaExec","correct":"udaExec = teradata.UdaExec(appName='test')"}],"quickstart":{"code":"import teradata\n\nudaExec = teradata.UdaExec(appName='test', version='1.0', logConsole=False)\nsession = udaExec.connect(method='odbc', system='your_td_host', username=os.environ.get('TD_USER', ''), password=os.environ.get('TD_PASS', ''))\n\nquery = \"SELECT DATABASENAME FROM DBC.DATABASESV WHERE DATABASENAME = 'DBC'\"\ndf = session.execute(query).fetchall()\nprint(df)\nsession.close()","lang":"python","description":"Connect using ODBC and run a simple query."},"warnings":[{"fix":"Install Teradata ODBC driver (Windows) or use method='rest' with REST endpoints (if available).","message":"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.","severity":"gotcha","affected_versions":"all"},{"fix":"Migrate to `pip install teradatasql` and update connection syntax.","message":"Library in maintenance: Teradata recommends using `teradatasql` for new projects. `teradata` (PyTd) is no longer actively developed.","severity":"deprecated","affected_versions":">=15.0"},{"fix":"Always iterate or call `.fetchall()` and ensure result set is consumed or closed.","message":"Connection leaks: `execute()` returns a result set that must be closed or fetched entirely; otherwise, subsequent queries may hang.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use `session.execute(query, fetch_size=1000)` to limit fetch size.","cause":"Result set too large for ODBC driver buffer; default fetch size is unlimited.","error":"Error: ('HY000', '[HY000] [Teradata][ODBC Teradata Driver] Not enough memory')"},{"fix":"Grant necessary permissions via Teradata DBA.","cause":"User lacks required privileges (e.g., creating tables, macros).","error":"teradata.api.DatabaseError: (3707, '[Teradata Database] [3932] The user is not a privileged user.')"},{"fix":"Use `import teradata` and reference `teradata.UdaExec`.","cause":"Incorrect import; user tried `from teradata import UdaExec`.","error":"AttributeError: module 'teradata' has no attribute 'UdaExec'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}