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:
| Field | Description | Required | Default |
|---|---|---|---|
--url
|
The Airflow server URL |
|
None |
--external-url
|
The external URL for the instance |
|
None |
--name
|
The name for the integration |
|
None |
--env
|
The environment name for the integration |
|
None |
--include-sources
|
A flag. If enabled, monitors source code for tasks. |
|
False |
--dag-ids
|
DAG IDs (separated with a comma) for the monitor to fetch |
|
None |
--last-seen-dag-run-id
|
The ID of the last DAG run in the Airflow database |
|
None |
--last-seen-log-id
|
The ID of the last log in the Airflow database |
|
None |
--generate-token
|
Used to generate an access token for the integration - its value is the token lifespan provided in seconds. |
|
None |
--config-file-output
|
Used to integrate config JSON to file |
|
None |
--with-auto-alerts
|
A flag. Creates an integration with automatic alerting for pipeline failures, run duration anomalies, and schema changes. |
|
False |
--include-logs-bytes-from-head [0-8096] |
The number of bytes to collect from the head of the log file |
|
0 |
--include-logs-bytes-from-end [0-8096] |
The number of bytes to collect from the end of the log file |
|
0 |
--dag-run-bulk-size
|
The DAG run bulk size for the integration |
|
None |
--start-time-window
|
The start time window for the integration (X days backwards) |
|
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.
| Field | Description | Required |
|---|---|---|
--tracking-source-uid
|
Tracking source UID of the edited Airflow integration (you can get the UID by running the
list command). |
|
- 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