airflow.providers.teradata.operators.bteq¶
Classes¶
Teradata Operator to execute SQL Statements or BTEQ (Basic Teradata Query) scripts using Teradata BTEQ utility. |
Functions¶
|
Module Contents¶
- class airflow.providers.teradata.operators.bteq.BteqOperator(*, sql=None, file_path=None, teradata_conn_id=TeradataHook.default_conn_name, ssh_conn_id=None, remote_working_dir=None, bteq_session_encoding=None, bteq_script_encoding=None, bteq_quit_rc=None, timeout=600, timeout_rc=None, **kwargs)[source]¶
Bases:
airflow.models.BaseOperator
Teradata Operator to execute SQL Statements or BTEQ (Basic Teradata Query) scripts using Teradata BTEQ utility.
This supports execution of BTEQ scripts either locally or remotely via SSH.
The BTEQ scripts are used to interact with Teradata databases, allowing users to perform operations such as querying, data manipulation, and administrative tasks.
Features: - Supports both local and remote execution of BTEQ scripts. - Handles connection details, script preparation, and execution. - Provides robust error handling and logging for debugging. - Allows configuration of session parameters like session and BTEQ I/O encoding.
See also
For more information on how to use this operator, take a look at the guide: BteqOperator
- Parameters:
sql (str | None) – SQL statement(s) to be executed using BTEQ. (templated)
file_path (str | None) – Optional path to an existing SQL or BTEQ script file. If provided, this file will be used instead of the sql content. This path represents remote file path when executing remotely via SSH, or local file path when executing locally.
teradata_conn_id (str) – Reference to a specific Teradata connection.
ssh_conn_id (str | None) – Optional SSH connection ID for remote execution. Used only when executing scripts remotely.
remote_working_dir (str | None) – Temporary directory location on the remote host (via SSH) where the BTEQ script will be transferred and executed. Defaults to /tmp if not specified. This is only applicable when ssh_conn_id is provided.
bteq_session_encoding (str | None) – Character set encoding for the BTEQ session. Defaults to ASCII if not specified.
bteq_script_encoding (str | None) – Character encoding for the BTEQ script file. Defaults to ASCII if not specified.
bteq_quit_rc (int | list[int] | tuple[int, Ellipsis] | None) – Accepts a single integer, list, or tuple of return codes. Specifies which BTEQ return codes should be treated as successful, allowing subsequent tasks to continue execution.
timeout (int | Literal[600]) – Timeout (in seconds) for executing the BTEQ command. Default is 600 seconds (10 minutes).
timeout_rc (int | None) – Return code to use if the BTEQ execution fails due to a timeout. To allow DAG execution to continue after a timeout, include this value in bteq_quit_rc. If not specified, a timeout will raise an exception and stop the DAG.