airflow.providers.teradata.hooks.teradata

An Airflow Hook for interacting with Teradata SQL Server.

Attributes

Classes

TeradataHook

General hook for interacting with Teradata SQL Database.

Module Contents

airflow.providers.teradata.hooks.teradata.PARAM_TYPES[source]
class airflow.providers.teradata.hooks.teradata.TeradataHook(*args, database=None, **kwargs)[source]

Bases: airflow.providers.common.sql.hooks.sql.DbApiHook

General hook for interacting with Teradata SQL Database.

This module contains basic APIs to connect to and interact with Teradata SQL Database. It uses teradatasql client internally as a database driver for connecting to Teradata database. The config parameters like Teradata DB Server URL, username, password and database name are fetched from the predefined connection config connection_id. It raises an airflow error if the given connection id doesn’t exist.

You can also specify ssl parameters in the extra field of your connection as {"sslmode": "require", "sslcert": "/path/to/cert.pem", etc}.

Parameters:
  • args – passed to DbApiHook

  • database (str | None) – The Teradata database to connect to.

  • kwargs – passed to DbApiHook

conn_name_attr = 'teradata_conn_id'[source]
default_conn_name = 'teradata_default'[source]
supports_autocommit = True[source]
supports_executemany = True[source]
conn_type = 'teradata'[source]
hook_name = 'Teradata'[source]
placeholder: str = '?'[source]

Return SQL placeholder.

get_conn()[source]

Create and return a Teradata Connection object using teradatasql client.

Establishes connection to a Teradata SQL database using config corresponding to teradata_conn_id.

Returns:

a Teradata connection object

Return type:

teradatasql.TeradataConnection

set_query_band(query_band_text, teradata_conn)[source]

Set SESSION Query Band for each connection session.

get_sqlalchemy_engine(engine_kwargs=None)[source]

Return a connection object using sqlalchemy.

static get_ui_field_behaviour()[source]

Return custom field behaviour.

callproc(identifier, autocommit=False, parameters=None)[source]

Call the stored procedure identified by the provided string.

Any OUT parameters must be provided with a value of either the expected Python type (e.g., int) or an instance of that type.

Parameters:
  • identifier (str) – stored procedure name

  • autocommit (bool) – What to set the connection’s autocommit setting to before executing the query.

  • parameters (list | dict | None) – The IN, OUT and INOUT parameters for Teradata stored procedure

The return value is a list or mapping that includes parameters in both directions; the actual return type depends on the type of the provided parameters argument.

Was this entry helpful?