Document how to use an existing Airflow installation to orchestrate Meltano
Or Barda asked on Slack:
Hi guys, is there a way to use already running AirFlow in Meltano as the orchestrator?
I responded:
Absolutely! Using Meltano's "built-in" Airflow orchestrator really just means installing it into a Meltano-managed Python venv inside
.meltano, and invoking it throughmeltano invokeso that some default Meltano-compatible configuration can be dynamically applied at invocation time: https://gitlab.com/meltano/meltano/blob/master/src/meltano/core/bundle/discovery.yml#L840-855That config points Airflow to
$MELTANO_PROJECT_ROOT/orchestrate/dagsto look for dags, which is where you'll find https://gitlab.com/meltano/files-airflow/-/blob/master/bundle/orchestrate/dags/meltano.py (sincemeltano add orchestrator airflowalso addd the Airflow file bundle from that repo).That DAG should work with any Airflow installation as long as the
MELTANO_PROJECT_ROOTenv var is set to point at the Meltano project directory, and as long as Meltano itself is installed andmeltano installhas been run inside the project.That setup assumes you'll use
meltano scheduleto schedule yourmeltano eltpipelines, since it iterates over the result ofmeltano schedule list --format=jsonto create DAGs for each, but you can also create your own DAGs for any pipeline you fancy usingBashOperator+meltano elt, orDockerOperator+docker run <your project image> elt ...(see https://meltano.com/#containerization)