diff --git a/modules/ROOT/pages/airflow.adoc b/modules/ROOT/pages/airflow.adoc index c035f3b31..1c1b456bf 100644 --- a/modules/ROOT/pages/airflow.adoc +++ b/modules/ROOT/pages/airflow.adoc @@ -14,7 +14,7 @@ This tutorial demonstrates how to use airflow with Teradata Vantage. Airflow wil == Prerequisites -* Ubuntu 22.x +* Ubuntu 22.x * Access to a Teradata Vantage instance. + include::ROOT:partial$vantage_clearscape_analytics.adoc[] @@ -62,7 +62,13 @@ airflow standalone ---- 2. Access the Airflow UI. Visit https://localhost:8080 in the browser and log in with the admin account details shown in the terminal. -== Define a Teradata connection in Airflow UI + +Teradata Connections may be defined in Airflow in the following ways: + +1. Using Airflow Web UI +2. Using Environment Variable + +== Define a Teradata connection in Airflow Web UI 1. Open the Admin -> Connections section of the UI. Click the Create link to create a new connection. + @@ -78,7 +84,46 @@ image::{dir}/airflow-newconnection.png[Airflow New Connection, width=75%] * Password (required): Specify the password to connect. * Click on Test and Save. +== Define a Teradata connection in Environment Variable +Airflow connections may be defined in environment variables in either of one below formats. + +1. JSON format +2. URI format + ++ +NOTE: The naming convention is AIRFLOW_CONN_{CONN_ID}, all uppercase (note the single underscores surrounding CONN). +So if your connection id is teradata_conn_id then the variable name should be AIRFLOW_CONN_TERADATA_CONN_ID ++ + + +== JSON format example + + +[source, bash] +---- +export AIRFLOW_CONN_TERADATA_CONN_ID='{ + "conn_type": "teradata", + "login": "teradata_user", + "password": "my-password", + "host": "my-host", + "schema": "my-schema", + "extra": { + "tmode": "TERA", + "sslmode": "verify-ca" + } +}' + +---- + +== URI format example + + +[source, bash] +---- +export AIRFLOW_CONN_TERADATA_CONN_ID='teradata://teradata_user:my-password@my-host/my-schema?tmode=TERA&sslmode=verify-ca' +---- +Refer https://airflow.apache.org/docs/apache-airflow-providers-teradata/stable/connections/teradata.html[Teradata Hook] for detailed information on Teradata Connection in Airflow. == Define a DAG in Airflow @@ -135,7 +180,7 @@ with DAG( == Summary -This tutorial demonstrated how to use Airflow and the Airflow Teradata provider with a Teradata Vantage instance. The example DAG provided creates `my_users` table in the Teradata Vantage instance defined in Connection UI. +This tutorial demonstrated how to use Airflow and the Airflow Teradata provider with a Teradata Vantage instance. The example DAG provided creates `my_users` table in the Teradata Vantage instance defined in Connection UI. == Further reading * link:https://airflow.apache.org/docs/apache-airflow/stable/start.html[airflow documentation]