airflow.providers.teradata.hooks.tpt¶
Classes¶
Hook for executing Teradata Parallel Transporter (TPT) operations. |
Module Contents¶
- class airflow.providers.teradata.hooks.tpt.TptHook(ssh_conn_id=None, *args, **kwargs)[source]¶
Bases:
airflow.providers.teradata.hooks.ttu.TtuHookHook for executing Teradata Parallel Transporter (TPT) operations.
This hook provides methods to execute TPT operations both locally and remotely via SSH. It supports DDL operations using tbuild utility. and data loading operations using tdload. It extends the TtuHook and integrates with Airflow’s SSHHook for remote execution.
The TPT operations are used to interact with Teradata databases for DDL operations such as creating, altering, or dropping tables and high-performance data loading and DDL operations.
Features: - Supports both local and remote execution of TPT operations. - Secure file encryption for remote transfers. - Comprehensive error handling and logging. - Resource cleanup and management.
See also
- Parameters:
ssh_conn_id (str | None) – SSH connection ID for remote execution. If None, executes locally.
- execute_ddl(tpt_script, remote_working_dir)[source]¶
Execute a DDL statement using TPT.
- Args:
tpt_script: TPT script content as string or list of strings remote_working_dir: Remote working directory for SSH execution
- Returns:
Exit code from the TPT operation
- Raises:
ValueError: If tpt_script is empty or invalid RuntimeError: Non-zero tbuild exit status or unexpected execution failure ConnectionError: SSH connection not established or fails TimeoutError: SSH connection/network timeout FileNotFoundError: tbuild binary not found in PATH
- execute_tdload(remote_working_dir, job_var_content=None, tdload_options=None, tdload_job_name=None)[source]¶
Execute a tdload operation using the tdload command-line utility.
- Args:
remote_working_dir: Remote working directory for SSH execution job_var_content: Content of the job variable file tdload_options: Additional command-line options for tdload tdload_job_name: Name for the tdload job
- Returns:
Exit code from the tdload operation
- Raises:
RuntimeError: Non-zero tdload exit status or unexpected execution failure ConnectionError: SSH connection not established or fails TimeoutError: SSH connection/network timeout FileNotFoundError: tdload binary not found in PATH