Connect to Teradata

This topic describes how to connect to Teradata from Domino.

Teradata Vantage is a multi-cloud data platform providing access to data lakes, data warehouses, and analytics. You must have network connectivity between Teradata and your Domino deployment.

The easiest way to connect to Teradata from Domino is to create a Domino Data Source as described below.

Create a Teradata Data Source

Administrators can create a Data Source for Teradata that Domino users can access. Domino recommends this method. See the Admin Guide for details.

After your administrator has created the Data Source, you can query it.

Note

You must specify the database name in your query, as in this example where td_demo is the database name and yellow_cab is the table name:

example res = ds.query("select * from td_demo.yellow_cab")

Alternate way to connect to a Teradata Data Source

Warning
Domino does not officially support this method. We provide this information as a courtesy.

Domino recommends the Teradata SQL Driver for Python.

Environment setup

The Teradata SQL driver for Python comes pre-installed in several Domino environments. If your environment does not have it installed by default, you can use the following Dockerfile instructions to add it to your environment:

RUN pip install teradatasql

Credential setup

Set the following Domino environment variables to store secure information about your Teradata connection.

  • TERADATA_USER

  • TERADATA_PASSWORD

  • TERADATA_HOST

See Store Project credentials to learn more about Domino environment variables.

Usage

See the Teradata SQL Driver for Python documentation for information about how to use the package. The following is an example.

import teradatasql
import os

con = teradatasql.connect(
    user=os.environ['TERADATA_USER'],
    password=os.environ['TERADATA_PASSWORD'],
    host=os.environ['TERADATA_HOST']
    )
cur = con.cursor()
try:
    cur.execute ('{fn teradata_nativesql}Driver version {fn teradata_driver_version}  Database version {fn teradata_database_version}')
    print (cur.fetchone () [0])
finally:
    cur.close()
con.close()

Additional resources for Teradata SQL Driver

Next steps