Skip to content

Build and manage data products

How to add sources, domains, data products, resources and Gold models to a project, how their names line up, and how to check and deploy a change. For a guided first walkthrough of the same steps, follow the tutorial.

Run every command from the project directory, on a deployed local platform. The examples use the source marketing_platform, the domain marketing and the product campaign_performance.

Ownership follows the medallion layer:

Layer Owned by Directory Built by
Bronze A source lakehouse_code/bronze/<source>/ dlt
Silver A domain lakehouse_code/silver/<domain>/ Floe
Gold A data product lakehouse_code/gold/<product>/ dbt-trino
Dashboards A dashboard lakehouse_code/dashboards/superset/<dashboard>/ Superset

lakehouse_code/lakehouse.yaml declares the sources, domains, products and dashboards; each source also has a source.yaml. OpenLakeForge derives every platform name from these, so you never create catalog namespaces or edit Terraform to register a product:

Derived name Example Shared by
Bronze namespace <source>_bronze marketing_platform_bronze Every product reading the source
Silver namespace <domain>_silver marketing_silver Every product of the domain
Gold namespace <product>_gold campaign_performance_gold The product only
Dagster job <product>_pipeline campaign_performance_pipeline The product only

Every identifier matches ^[a-z][a-z0-9_]*$, so campaign_performance, not campaign-performance. A product id is unique across the whole lakehouse. Field-by-field rules are in the descriptor reference.

Terminal window
olf source new marketing_platform --resource campaigns

Repeat --resource for each table-like input. The command writes bronze/marketing_platform/ with a source.yaml, a dlt loader under dlt/ and one placeholder CSV per resource under examples/, and adds the source to lakehouse.yaml. It validates its result first and writes nothing if validation fails.

Replace each placeholder CSV with your real columns before you create a domain or product that reads it: the Silver contract’s columns are inferred from that file at creation time.

Terminal window
olf domain new marketing --input marketing_platform/campaigns

A domain owns a set of Silver tables. Each --input <source>/<resource> becomes a Silver table of the same name, validated by an entity in the domain’s Floe contract, silver/marketing/contracts/floe/marketing.yml. The contract declares column types, a primary key and a rejected-rows path; every column starts as nullable: false, so loosen a column by hand when a value may be empty. A domain has exactly one Floe contract: never add a second one.

olf product new also creates the domain when its --input names a domain that does not exist yet, so this step is optional.

Terminal window
olf product new marketing/campaign_performance \
--silver-input campaigns \
--gold-table mart_campaign_performance
Option Use
--silver-input <table> A Silver table the domain already has. Repeatable.
--input <source>/<resource> A Bronze resource to add to the domain’s Silver and read. Creates the domain if needed. Repeatable.
--gold-table <mart> A Gold mart the product produces. Repeatable, at least one.
--with-report Also scaffold a draft Superset report; see Dashboards as code.

It creates a dbt project under gold/campaign_performance/dbt/ and a Dagster module pipelines/dagster/campaign_performance.py, and registers the product in lakehouse.yaml. Dagster loads every module in that directory by itself.

The generated model models/gold/mart_campaign_performance.sql selects everything from the first Silver input. Replace it with your SQL, reading Silver through {{ source('silver', '<table>') }}, and describe and test it in models/gold/schema.yml; dbt runs the tests in the same build, so a failing test fails the run. Do not hard-code Trino hosts or catalogs: OpenLakeForge renders the dbt profile for each stage.

  1. Add it under resources in bronze/marketing_platform/source.yaml.

  2. Add its data as examples/<resource>.csv.

  3. Add its name to the entity tuple in dlt/marketing_platform.py:

    MARKETING_PLATFORM_ENTITIES = ("campaigns", "ad_groups")
  4. Carry it into Silver. The simplest way is a new product that reads it, which also adds the Silver table and its Floe entity:

    Terminal window
    olf product new marketing/ad_group_report \
    --input marketing_platform/ad_groups --gold-table mart_ad_groups

To let an existing product read the resource instead, make these edits by hand:

File Add
lakehouse.yaml A silver_tables entry {name: ad_groups, source: marketing_platform, resource: ad_groups} under the domain, and ad_groups in the product’s silver_inputs
silver/marketing/contracts/floe/marketing.yml An ad_groups entity, copied from an existing one
gold/<product>/dbt/models/sources.yml - name: ad_groups under the silver source
pipelines/dagster/<product>.py "ad_groups" in the Silver inputs tuple and ("marketing_platform", "ad_groups") in bronze_inputs
gold/<product>/dbt/models/gold/<mart>.sql A read of {{ source('silver', 'ad_groups') }}
  1. Add models/gold/<mart>.sql and describe it in models/gold/schema.yml.

  2. Declare it under the product’s gold_tables.tables in lakehouse.yaml.

  3. Add its name to the Gold assets tuple in pipelines/dagster/<product>.py:

    CAMPAIGN_PERFORMANCE_GOLD_ASSETS = (
    "mart_campaign_performance",
    "mart_campaign_daily",
    )

Delete its entry from lakehouse.yaml, its gold/<product>/ directory and its Dagster module. Dagster loads every module under pipelines/dagster/, declared or not, so a leftover module keeps the job alive.

Renaming a source, domain, product or table changes the derived namespaces, so on a deployed stage treat it as a data migration, not an edit. displayName, description and status are metadata only.

Command Checks
olf check contracts Each descriptor against its schema: identifiers, duplicates, undeclared resources
olf check project-code The whole inventory loads in Dagster, including references between descriptors
olf check dbt Every product’s dbt project compiles
olf floe generate-manifests Every domain’s Floe contract is valid

Then deploy only the artifacts phase, which covers everything derived from lakehouse_code/:

Terminal window
olf deploy --provider local --phase artifacts

It reconciles the catalog namespaces, generates the Floe manifests (never edit them by hand), builds the project-code image and restarts Dagster’s code location.

Launch campaign_performance_pipeline in Dagster, then query the mart:

Terminal window
olf query "SELECT * FROM campaign_performance_gold.mart_campaign_performance"

olf e2e run --env local --suite full also covers the new product, because it discovers products from lakehouse.yaml.


Synced from openlakeforge @ v0.5.0-alpha.1 (1598142), docs/guides/data-products.md.