> For the complete documentation index, see [llms.txt](https://v2.dataos.info/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://v2.dataos.info/build/recipes/reuse-data-products.md).

# Reuse a Data Product

Build a downstream product that reads another product's published outputs, instead of rebuilding the same logic from scratch.

When one product publishes trusted output tables, another product can read them directly instead of rebuilding the same logic. The upstream product owns the source-aligned facts and dimensions. The downstream product declares those outputs as read-only inputs, transforms them, and publishes its own models, semantics, and metrics. Each product keeps its own outputs and is deployed independently.

Use this recipe before you build anything new. If an existing product already covers what you need, reuse it instead of rebuilding it. Check the catalog first (the [Datasets](https://v2.dataos.info/build/understand/explore-data/datasets.md) and Hub views show what is already productized), then build on top only where you must.

This recipe uses two products:

| Product             | Role                | What it does                                              |
| ------------------- | ------------------- | --------------------------------------------------------- |
| `customer-orders`   | Upstream producer   | Publishes clean customer profiles and order facts         |
| `customer-insights` | Downstream consumer | Reads those tables and builds revenue and health insights |

{% hint style="info" %}
The upstream product must already be applied, and its output tables must be stable and documented, before a downstream product can safely depend on them.
{% endhint %}

## Steps

### 1. Confirm the upstream contract

The upstream product, `customer-orders`, is `source_aligned` and publishes two output tables:

```
customer_orders.customer_profiles   customer dimension
customer_orders.order_facts         order fact with net_revenue
```

These tables are the contract. `order_facts` exposes `customer_id`, `order_date`, `status`, and `net_revenue` as stable columns that downstream products can safely join. Apply the upstream product first:

```bash
cd customer_orders_dp && vulcan plan
```

### 2. Declare the upstream tables downstream

The downstream product, `customer-insights`, is `consumer_aligned`. Before writing any SQL, it declares which upstream tables it reads in `inputs.yaml`. This is the read-only contract between the two products. Vulcan uses it to validate downstream SQL and to record cross-product lineage.

```yaml
- name: '"warehouse"."customer_orders"."customer_profiles"'
  columns:
    customer_id: INT
    customer_tier: TEXT
    status: TEXT
- name: '"warehouse"."customer_orders"."order_facts"'
  columns:
    order_id: INT
    customer_id: INT
    order_date: DATE
    status: TEXT
    net_revenue: DECIMAL(12, 2)
```

Use the fully qualified name that matches the warehouse, schema, and table the upstream product produces.

### 3. Build downstream models

The downstream product does not recreate customer or order logic. It reads the declared tables and layers its own analytics on top. Here, a revenue summary joins the two upstream tables:

```sql
MODEL (
  name customer_insights.customer_revenue_summary,
  kind FULL,
  grains (customer_id)
);

SELECT
  cp.customer_id, cp.customer_tier, cp.status,
  COUNT(o.order_id) AS total_orders,
  COALESCE(SUM(o.net_revenue) FILTER (WHERE o.status = 'completed'), 0) AS total_lifetime_value
FROM customer_orders.customer_profiles AS cp
LEFT JOIN customer_orders.order_facts AS o ON cp.customer_id = o.customer_id
GROUP BY cp.customer_id, cp.customer_tier, cp.status;
```

The downstream graph now carries two kinds of lineage: external lineage back to `customer-orders`, and internal lineage between its own models.

### 4. Publish its own semantics and metrics

This is what separates reusing a product from simply reading a table: the downstream product gets its own governed query surface. Define a semantic model and a metric over the summary, and consumers of `customer-insights` can query `customer_lifetime_value` without knowing anything about the upstream product. See [Semantic model](https://v2.dataos.info/build/productize/assets/semantic-model.md) and [Metrics](https://v2.dataos.info/build/productize/assets/metrics.md).

## Best practices

* Apply the upstream product first, then the downstream product.
* If the upstream contract changes, update the downstream `inputs.yaml` before the next plan.
* Declare every upstream table a downstream product reads in `inputs.yaml`, with names matching the SQL exactly.
* Give the downstream product its own isolated state, and its own semantics and metrics.
* Always go through `inputs.yaml` for governed reuse. Do not copy upstream SQL into the downstream project unless ownership of that logic is intentionally moving.

## Troubleshooting

| Symptom                                               | Likely cause                                                                                   | Fix                                                                                    |
| ----------------------------------------------------- | ---------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- |
| Downstream plan fails to validate a referenced column | `inputs.yaml` is missing a table or column the SQL references                                  | Add the missing table or column to `inputs.yaml`, matching the upstream schema exactly |
| Downstream query returns stale or missing data        | The upstream product hasn't been applied since a recent change                                 | Re-apply the upstream product, then re-plan the downstream product                     |
| Table name in `inputs.yaml` doesn't resolve           | The name doesn't match the warehouse, schema, and table the upstream product actually produces | Use the fully qualified name exactly as the upstream product names its output          |
| Downstream and upstream logic drift out of sync       | Upstream SQL was copied into the downstream project instead of read through `inputs.yaml`      | Read the upstream table through `inputs.yaml` instead of duplicating its logic         |

## Related recipes

* [Wait for data to be ready with signals](https://v2.dataos.info/build/recipes/wait-for-data-with-signals.md) - gate a model's run on upstream data actually being present.

## References

* [Inputs](https://v2.dataos.info/build/productize/assets/inputs.md) - the full `inputs.yaml` contract reference.
* [Semantic model](https://v2.dataos.info/build/productize/assets/semantic-model.md) - wrap a model with business-friendly dimensions and measures.
* [Metrics](https://v2.dataos.info/build/productize/assets/metrics.md) - define reusable, time-series metrics on top of a semantic model.
* [External models](https://v2.dataos.info/references/resources/vulcan/models/data-models/types/external-models) - the full reference for how Vulcan reads `inputs.yaml` entries.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://v2.dataos.info/build/recipes/reuse-data-products.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
