Create connection using environment variables | Teradata Package for Python - Create a connection using environment variables - Teradata Package for Python

Teradata® Package for Python User Guide

Deployment
VantageCloud
VantageCore
Edition
VMware
Enterprise
IntelliFlex
Product
Teradata Package for Python
Release Number
20.00
Published
March 2025
ft:locale
en-US
ft:lastEdition
2026-01-07
dita:mapPath
nvi1706202040305.ditamap
dita:ditavalPath
plt1683835213376.ditaval
dita:id
rkb1531260709148
Product Category
Teradata Vantage

create_context() can establish connection to Vantage with the environment variables.

  • Environment variables should always start with prefix "TD_". For example, to read "host" from environment variable, set the environment variable to "TD_HOST".
  • You can specify any argument with the format specified in Create connection using config file and create_context() considers all these variables for establishing connection to Vantage.

Example

Set the following variables using os.environ, then run the example:
  • os.environ['TD_HOST'] = 'tdhost'
  • os.environ['TD_USERNAME'] = 'tduser'
  • os.environ['TD_PASSWORD'] = 'tdpassword'
>>> td_context = create_context()