CLI for managing Airflow integrations

Apart from creating your Airflow integrations by using the Databand UI, you can also create a new Airflow integration in Databand with the command line interface.

Prerequisites

Before you run the command, make sure that you have DATABAND_URL and DATABAND_ACCESS_TOKEN set to the correct values. For more details on creating a new access token, see the Personal access token section.

add command

To create an Airflow integration, you need to run the dbnd airflow-sync add command with the following arguments:

Table 1. Arguments for the dbnd airflow-sync add command
Field Description Required Default
--url The Airflow server URL Yes None
--external-url The external URL for the instance No None
--name The name for the integration No None
--env The environment name for the integration No None
--include-sources A flag. If enabled, monitors source code for tasks. No False
--dag-ids DAG IDs (separated with a comma) for the monitor to fetch No None
--last-seen-dag-run-id The ID of the last DAG run in the Airflow database No None
--last-seen-log-id The ID of the last log in the Airflow database No None
--generate-token Used to generate an access token for the integration - its value is the token lifespan provided in seconds. No None
--config-file-output Used to integrate config JSON to file No None
--with-auto-alerts A flag. Creates an integration with automatic alerting for pipeline failures, run duration anomalies, and schema changes. No False
--include-logs-bytes-from-head [0-8096] The number of bytes to collect from the head of the log file No 0
--include-logs-bytes-from-end [0-8096] The number of bytes to collect from the end of the log file No 0
--dag-run-bulk-size The DAG run bulk size for the integration No None
--start-time-window The start time window for the integration (X days backwards) No None
Example add command
dbnd airflow-sync add --url http://airflow:8082 --name my_airflow

list command

Use the list command to get the a list of all available integrations and their tracking-source-uid.

dbnd airflow-sync list

edit command

For the edit command you can use all parameters from the add command, apart from --generate-token and --config-file-output.

Table 2. Additional arguments for the edit command
Field Description Required
--tracking-source-uid Tracking source UID of the edited Airflow integration (you can get the UID by running the list command). Yes
Example edit command
dbnd airflow-sync edit --tracking-source-uid c9cc2928-6966-11ac-ba39-adde48001122 \
          --url http://airflow:8082 --name my_airflow

archive command

Use the command to delete the integration. To do so you need to provide its trackig-source-uid.

dbnd airflow-sync archive --tracking-source-uid c9cc2928-6966-11ac-ba39-adde48001122