Skip to content

Build and manage data products

View as Markdownllms.txt

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/models/<product>/ dbt-trino
Dashboards A dashboard lakehouse_code/dashboards/superset/<dashboard>/ Superset

lakehouse_code/governance.yml names the domains and, nested under each, its products; each source has a source.yaml, and each dashboard is a bundle directory. 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
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/. 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 its own entity file, silver/marketing/contracts/<resource>.yml. The domain’s silver/marketing/domain.yml sets the Iceberg namespace, the rejected-rows path and the policy for all of them. An entity declares column types and a primary key; every column starts as nullable: false, so loosen a column by hand when a value may be empty. Floe validation describes the layout.

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 the product’s folder gold/models/campaign_performance/ in the Gold dbt project and registers the product in governance.yml. It also adds the product’s +group block to gold/dbt_project.yml and declares any Silver table the domain’s gold/models/_sources/<domain>.yml lacks; the first product creates the project itself. It writes no Dagster code: pipelines/definitions.py builds a job for every product in governance.yml, and pipelines/products.py needs an entry only to change a product’s cadence or inputs.

The generated model mart_campaign_performance.sql selects everything from the first Silver input. Replace it with your SQL, reading Silver through {{ source('<domain>', '<table>') }}, and describe and test it in the product’s 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
silver/marketing/contracts/ad_groups.yml An entity file, copied from an existing one, with source: { ref: marketing_platform, resource: ad_groups }
gold/models/_sources/marketing.yml - name: ad_groups under the marketing source
gold/models/<product>/<mart>.sql A read of {{ source('marketing', 'ad_groups') }}
  1. Add gold/models/<product>/<mart>.sql and describe it in the product’s schema.yml. No descriptor lists it: its folder puts it in <product>_gold, and a table there belongs to the product.

    The product’s Dagster job picks the model up from the dbt project; nothing in pipelines/ lists it.

A product’s models are private to it: gold/dbt_project.yml sets +access: private, and each product is a dbt group. To let another product ref() a mart, set access: public on that model in its schema.yml:

models:
- name: mart_campaign_performance
access: public

A ref() to a model that is not public fails to parse. The reading product’s job uses the model as it is and never rebuilds it, so its Dagster asset is an upstream dependency of the reading product’s assets.

Run the owning product first. The reading product’s dbt step fails, naming the owner, when the owner has never built the model on that stage or has a run queued or running, instead of reading a stale or half-replaced set of tables. Schedule the owner’s cadence before its readers’ in pipelines/products.py. The e2e runner launches the products owners first. The guard checks that the model was built at some point, not that it is fresh. It runs once, when the reading product’s dbt step starts: a producer in another domain that starts later is not held back (runs of one domain already queue one at a time), so keep the owner’s schedule ahead of its readers’. olf check contracts lists each dependency (product_dependencies) and refuses a ref() to a model that is not access: public, or two products that read each other.

The example sales_core product is built for this: it holds the sales domain’s row-level fact (fct_order_lines) and conformed dimensions (dim_account, dim_product, dim_channel, dim_promotion), all access: public with every model and column described and its keys tested (unique and not_null, plus relationships from each fact key to its dimension). Marts aggregate such models; business filters such as “fulfilled orders only” belong to the metric that uses them, not to the fact. order_revenue, customer_health and inventory_reliability read sales_core.

A deploy publishes the Gold graph to OpenMetadata, so a person or an agent can tell a conformed fact from a presentation mart and see which products a product builds on:

  • Role. Every Gold table carries one tag of the GoldRole classification, which OpenLakeForge creates: Fact for fct_, Dimension for dim_, Mart for mart_. To give a model another name, set its role in its schema.yml entry, as Fact, Dimension or Mart in any letter case:

    models:
    - name: order_lines_wide
    meta:
    openlakeforge:
    role: fact

    A declared role wins over the prefix. olf check contracts fails (gold_roles) on a model that resolves neither. Tags of other classifications, and glossary terms, are left alone.

  • Dependencies. The ref() graph above becomes consumesFrom on the consuming data product, so order_revenue lists sales_core. A deploy adds a missing edge and never removes one. The consumed tables are not attached to the consuming product: it holds only the tables in its own <product>_gold schema, facts and dimensions included.

olf infra openmetadata drift reports a dependency dropped from Git while OpenMetadata still holds it, a missing edge, and a table without its role tag (Metadata ownership).

gold/dbt_project.yml sets +persist_docs for every Gold model, so the descriptions in schema.yml are written as table and column comments.

Keep one model’s reads to about 150 tables or fewer. Trino counts about two stages per table a query reads and stops at max_stage_count (300 in every query.size, see the deployment profile) with QUERY_HAS_TOO_MANY_STAGES. A union over a whole domain should be split into staging models.

Describe a product’s business metrics, keys and relationships as an Apache Ossie model in lakehouse_code/semantic/<product>/<name>.ossie.yaml. The datasets point at the product’s Gold facts and dimensions, and every key and relationship must be backed by a dbt unique or relationships test in the product’s schema.yml.

Terminal window
uv run --project tools/olf --locked olf check contracts

The semantic_models check names each broken rule with its file and line. The supported version, the subset and the rules are in Semantic models reference.

Section titled “Link a glossary term to a product and a column”

Business terms live in lakehouse_code/glossaries/<name>.yml; see the Glossary reference for the fields. Link a term by its <glossary>.<Term> reference.

  1. To the product, in governance.yml:

    products:
    - id: order_revenue
    displayName: Sales Order Revenue
    glossaryTerms: [sales.NetRevenue, sales.GrossRevenue]
  2. To the column that holds the term, in the product’s schema.yml:

    columns:
    - name: net_amount
    meta:
    openlakeforge:
    glossaryTerms: [sales.NetRevenue]

    Put it on a fact or dimension column (fct_, dim_), not on a mart_ column; olf check contracts warns about the latter.

  3. Check the references resolve:

    Terminal window
    olf check contracts

    A reference to a term that no glossary declares fails the check and names the file and path to fix.

olf infra openmetadata deploy-metadata (part of olf infra deploy) publishes each glossary and its terms first, then attaches them:

Git OpenMetadata
glossaries/<name>.yml Glossary <name>, with its terms (description, synonyms, related terms, references, status, owner)
glossaryTerms on a product or domain The glossary tag on that data product or domain
meta.openlakeforge.glossaryTerms on a column The glossary tag on that column of the stage’s own table, for example <service>.lakehouse_dev.sales_core_gold.fct_order_lines.net_amount

Glossaries and terms OLF publishes carry the olfManaged property. A repeat deploy of the same revision writes nothing. OLF never deletes: a term removed from Git stays in OpenMetadata and the deploy warns about it. A glossary, term or tag a person created under another name is left alone; one created by hand under the same name as a Git glossary or term is adopted, marked olfManaged and kept in step with Git on the fields Git declares. A column the Trino crawl has not produced yet is reported as pending and tagged on the first deploy after the crawl; OLF never creates a column for it.

Delete its entry from governance.yml, its gold/models/<product>/ folder, its block in gold/dbt_project.yml and its entry in pipelines/products.py, if it has one. The code location refuses an entry for a product governance.yml does not declare, so a leftover entry fails loudly instead of lingering.

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 the business fields (owner, tier, lifecycle and the others in the governance.yml reference) are metadata only.

olf infra deploy publishes owner, experts, reviewers, tier, classification, lifecycle and termsOfUse to OpenMetadata: owners and experts on the domain and data product pages, a Tier and a DataSensitivity tag on the product and on its Gold tables, and the lifecycle and terms of use as the custom properties olfLifecycle and olfTermsOfUse. An owner is an existing OpenMetadata user or team of type Group, and experts are users; create them in OpenMetadata or your identity provider first. On the local stack the demo project seeds its own: sales-analytics owns Sales, supply-chain-ops owns Supply Chain, and demo-analyst and demo-data-engineer are the experts and reviewers. That seeding is demo setup read from lakehouse_code/local-demo-teams.yml and never runs for another provider (details). classification only labels data: it does not change who can read a table. The descriptors reference lists every field.

A product can also declare how fresh it promises to be, with an sla block. The deploy publishes it as the data product’s native SLA and keeps the fields OpenMetadata has no place for in the olfFreshnessPolicy custom property. It is a promise: GET /stages/{stage}/sla reports whether the stage observed the product keeping it, see Product SLA compliance. See Product SLA for the fields.

To record who owns a product and how critical it is, set them on the product and run the strict check, which fails for a product that resolves no owner, tier or lifecycle:

Terminal window
olf check contracts --strict
Command Checks
olf check contracts Each descriptor against its schema: identifiers, duplicates, a domain or product without its directory; each Floe domain writes its own <domain>_silver namespace
olf check project-code The whole inventory loads in Dagster, including references between descriptors
olf check dbt Every product’s dbt project parses and compiles, and its models and sources sit in the schemas the descriptors name. Incremental models are parsed (refs, sources, Jinja) but not compiled: is_incremental() needs a warehouse connection, so their rendered SQL is not checked

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

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

It reconciles the catalog namespaces, builds the project-code image and restarts Dagster’s code location.

A project that needs a Python package (an API client, a dlt source) lists it in lakehouse_code/requirements.txt, with plain pins or ranges. The image installs the file in its own layer after the platform dependencies, constrained to their exact versions, so a project cannot change a platform pin. olf check project-code and the image build resolve the file against those pins and fail on a conflict. Unlike the platform lock, this layer is not hash-verified. Without the file the image is unchanged.

Launch campaign_performance_pipeline in Dagster, then query the mart:

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

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


Synced from openlakeforge @ v0.7.5-beta.1 (8a7bf72), docs/guides/data-products.md.