|
| 1 | += openlineage-trino-airflow |
| 2 | +:description: Demo showcasing OpenLineage data lineage emitted by Trino and Airflow and visualized in Marquez, enabled with minimal configuration. |
| 3 | + |
| 4 | +:openlineage: https://openlineage.io/ |
| 5 | +:marquez: https://marquezproject.ai/ |
| 6 | +:trino-openlineage-docs: https://trino.io/docs/current/admin/event-listeners-openlineage.html |
| 7 | +:airflow-openlineage-docs: https://airflow.apache.org/docs/apache-airflow-providers-openlineage/stable/index.html |
| 8 | + |
| 9 | +This demo shows how two Stackable Data Platform (SDP) products - Apache Trino and Apache Airflow - can emit |
| 10 | +{openlineage}[OpenLineage{external-link-icon}^] events with a single configuration toggle each, and how those events |
| 11 | +come together in {marquez}[Marquez{external-link-icon}^], the OpenLineage reference metadata server and UI. |
| 12 | + |
| 13 | +Install this demo on an existing Kubernetes cluster: |
| 14 | + |
| 15 | +[NOTE] |
| 16 | +==== |
| 17 | +The namespace `openlineage-demo` will be assumed in this guide. |
| 18 | +It will be created if it doesn't exist. |
| 19 | +==== |
| 20 | + |
| 21 | +[source,console] |
| 22 | +---- |
| 23 | +$ stackablectl demo install openlineage-trino-airflow -n openlineage-demo |
| 24 | +---- |
| 25 | + |
| 26 | +[WARNING] |
| 27 | +==== |
| 28 | +This demo should not be run alongside other demos. |
| 29 | +==== |
| 30 | + |
| 31 | +[#system-requirements] |
| 32 | +== System requirements |
| 33 | + |
| 34 | +To run this demo, your system needs at least: |
| 35 | + |
| 36 | +* 5 https://kubernetes.io/docs/tasks/debug/debug-cluster/resource-metrics-pipeline/#cpu[cpu units{external-link-icon}^] (core/hyperthread) |
| 37 | +* 12GiB memory |
| 38 | +* 15GiB disk storage |
| 39 | +
|
| 40 | +== Overview |
| 41 | + |
| 42 | +This demo will |
| 43 | + |
| 44 | +* Install the required Stackable operators |
| 45 | +* Spin up the following products |
| 46 | +** *Trino*: A fast distributed SQL query engine. It is configured with the built-in, first-party `openlineage` event |
| 47 | + listener so that every query emits table- and column-level lineage. |
| 48 | +** *Airflow*: A workflow orchestrator. The native `apache-airflow-providers-openlineage` provider is enabled so that |
| 49 | + DAG and task runs - including the datasets they read and write - are reported as lineage. |
| 50 | +** *PostgreSQL*: Metadata database for Airflow. |
| 51 | +** *Marquez*: The OpenLineage reference server + web UI (with its own PostgreSQL), used here as the consuming |
| 52 | + application that collects and visualizes the lineage. Marquez is only part of this demo, not an SDP product. |
| 53 | +* Mount and trigger a single Airflow DAG (`openlineage_demo`) that runs a small ELT pipeline in Trino |
| 54 | +* Let you explore the resulting lineage graph in the Marquez UI |
| 55 | + |
| 56 | +The DAG builds a layered set of tables using Trino's built-in `tpch` catalog as the source and the in-memory `memory` |
| 57 | +catalog as the sink: |
| 58 | + |
| 59 | +[source] |
| 60 | +---- |
| 61 | +tpch.tiny.customer ─┐ |
| 62 | + ├─> memory.demo.customer_orders |
| 63 | +tpch.tiny.orders ──┘ |
| 64 | +---- |
| 65 | + |
| 66 | +Both products report to the *same* Marquez instance (`http://marquez:5000`): Trino emits the per-query dataset lineage, |
| 67 | +while Airflow emits the job/task run events (and dataset lineage via the Trino SQL operator). |
| 68 | + |
| 69 | +== How OpenLineage is enabled |
| 70 | + |
| 71 | +This demo deliberately uses only the existing SDP override mechanisms - there are *no operator or CRD changes*. This |
| 72 | +mirrors how a future "single toggle" feature would behave, while validating the approach today. |
| 73 | + |
| 74 | +*Trino* loads the bundled `openlineage` event listener through a small properties file. A `ConfigMap` supplies the |
| 75 | +file, `podOverrides` mounts it, and `configOverrides` registers it in `config.properties`: |
| 76 | + |
| 77 | +[source,properties] |
| 78 | +---- |
| 79 | +event-listener.name=openlineage |
| 80 | +openlineage-event-listener.transport.type=HTTP |
| 81 | +openlineage-event-listener.transport.url=http://marquez:5000 |
| 82 | +openlineage-event-listener.transport.endpoint=/api/v1/lineage |
| 83 | +openlineage-event-listener.trino.uri=http://trino-coordinator:8080 |
| 84 | +---- |
| 85 | + |
| 86 | +See the {trino-openlineage-docs}[Trino OpenLineage event listener docs{external-link-icon}^] for details. |
| 87 | + |
| 88 | +*Airflow* only needs the provider pointed at Marquez, which is done with `envOverrides`: |
| 89 | + |
| 90 | +[source] |
| 91 | +---- |
| 92 | +AIRFLOW__OPENLINEAGE__TRANSPORT='{"type": "http", "url": "http://marquez:5000", "endpoint": "api/v1/lineage"}' |
| 93 | +AIRFLOW__OPENLINEAGE__NAMESPACE="airflow-openlineage-demo" |
| 94 | +---- |
| 95 | + |
| 96 | +See the {airflow-openlineage-docs}[Airflow OpenLineage provider docs{external-link-icon}^] for details. |
| 97 | + |
| 98 | +== List deployed Stackable services |
| 99 | + |
| 100 | +To list the installed Stackable services run the following command: |
| 101 | + |
| 102 | +[source,console] |
| 103 | +---- |
| 104 | +$ stackablectl stacklet list |
| 105 | +
|
| 106 | +┌─────────┬─────────┬───────────────────┬──────────────────────────────────────────┬─────────────────────────────────┐ |
| 107 | +│ PRODUCT ┆ NAME ┆ NAMESPACE ┆ ENDPOINTS ┆ CONDITIONS │ |
| 108 | +╞═════════╪═════════╪═══════════════════╪══════════════════════════════════════════╪═════════════════════════════════╡ |
| 109 | +│ airflow ┆ airflow ┆ openlineage-demo ┆ webserver-http http://172.19.0.3:31483 ┆ Available, Reconciling, Running │ |
| 110 | +├╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤ |
| 111 | +│ trino ┆ trino ┆ openlineage-demo ┆ coordinator-https https://172.19.0.5:31087 ┆ Available, Reconciling, Running │ |
| 112 | +└─────────┴─────────┴───────────────────┴──────────────────────────────────────────┴─────────────────────────────────┘ |
| 113 | +---- |
| 114 | + |
| 115 | +include::partial$instance-hint.adoc[] |
| 116 | + |
| 117 | +[NOTE] |
| 118 | +==== |
| 119 | +Marquez is not an SDP product, so it does not appear in `stackablectl stacklet list`. |
| 120 | +==== |
| 121 | + |
| 122 | +== Explore the lineage in Marquez |
| 123 | + |
| 124 | +Marquez does not have an external listener. Forward its web UI to your machine: |
| 125 | + |
| 126 | +[source,console] |
| 127 | +---- |
| 128 | +$ kubectl -n openlineage-demo port-forward svc/marquez-web 3000:3000 |
| 129 | +---- |
| 130 | + |
| 131 | +Then open http://localhost:3000 in your browser. |
| 132 | + |
| 133 | +Use the namespace selector at the top to switch between the namespaces that produced the lineage: |
| 134 | + |
| 135 | +* the Trino namespace (named after `openlineage-event-listener.trino.uri`, i.e. `http://trino-coordinator:8080`), |
| 136 | + which contains the `tpch.tiny.*` and `memory.demo.*` datasets and the queries connecting them, and |
| 137 | +* `airflow-openlineage-demo`, which contains the `openlineage_demo` DAG and its tasks. |
| 138 | + |
| 139 | +Selecting the `memory.demo.customer_orders` dataset and expanding upstream shows the full graph back to |
| 140 | +`tpch.tiny.customer` and `tpch.tiny.orders`, including column-level lineage for the individual queries. |
| 141 | + |
| 142 | +[NOTE] |
| 143 | +==== |
| 144 | +Trino and Airflow name datasets independently, so a given table may appear under both the Trino namespace (from the |
| 145 | +Trino event listener) and the Airflow namespace (from the SQL operator's extractor). This is expected - each producer |
| 146 | +reports lineage from its own perspective. |
| 147 | +==== |
| 148 | + |
| 149 | +== Summary |
| 150 | + |
| 151 | +This demo showed that both Trino and Airflow can emit OpenLineage data to Marquez with only a small amount of |
| 152 | +configuration and no changes to the SDP operators or CRDs. It serves as a validation of the approach ahead of adding |
| 153 | +first-class OpenLineage support to the platform. |
| 154 | + |
| 155 | +== Where to go from here |
| 156 | + |
| 157 | +* Trigger the `openlineage_demo` DAG again from the Airflow UI and watch new runs appear in Marquez. |
| 158 | +* Run your own queries against Trino (for example via `stackablectl stacklet list` to find the coordinator endpoint) |
| 159 | + and see them show up as additional lineage. |
| 160 | +* Read more about {openlineage}[OpenLineage{external-link-icon}^] and {marquez}[Marquez{external-link-icon}^]. |
0 commit comments