Ingest a source
This lesson adds a new source to the project with olf source new, gives it
data, and explains the dlt loader that lands that data in Bronze. The source
is a marketing platform that exports campaign performance as CSV.
You will scaffold a Bronze source and give it real data, in about 10 minutes.
Start from the project of lesson 1: deployed, with the three demo data products. Run every command from the project directory.
How the project is organized
Section titled “How the project is organized”Your code lives under lakehouse_code/, and each medallion layer has its own
owner (see
ADR 0004):
| Layer | Aligned to | Directory |
|---|---|---|
| Bronze | A source | lakehouse_code/bronze/<source>/ |
| Silver | A domain | lakehouse_code/silver/<domain>/ |
| Gold | A data product | lakehouse_code/gold/models/<product>/ |
Across the next lessons you add the source marketing_platform, the domain
marketing and the product campaign_performance. OpenLakeForge derives
every platform name from those three: the Silver namespace marketing_silver, the Gold
namespace campaign_performance_gold and the Dagster job
campaign_performance_pipeline. You never create these by hand and you never
edit Terraform to register a product.
1. Scaffold the source
Section titled “1. Scaffold the source”olf source new marketing_platform --resource campaignsCreated source 'marketing_platform' with 1 resource(s): campaigns.The command validates its result before it writes anything, and writes nothing if validation fails. It creates:
lakehouse_code/bronze/marketing_platform/├── source.yaml├── README.md├── examples/│ └── campaigns.csv└── dlt/ ├── __init__.py └── marketing_platform.py2. Read the source descriptor
Section titled “2. Read the source descriptor”source.yaml is the logical description of the source:
apiVersion: openlakeforge.io/v1beta1kind: Sourcename: marketing_platformdisplayName: "Marketing Platform"description: "Marketing Platform source system."status: plannedresources: - name: campaigns description: "Raw CSV campaigns."It lists the resources the source exposes and never names Polaris, Glue, S3 or
any other provider: OpenLakeForge derives the physical names from it. Its
name must match its directory.
3. Add the data
Section titled “3. Add the data”The scaffold wrote a placeholder file with a single column. Replace it with campaign data:
cat > lakehouse_code/bronze/marketing_platform/examples/campaigns.csv <<'CSV'campaign_id,campaign_date,channel,spend,conversionscmp_001,2026-08-01,search,120.50,18cmp_002,2026-08-01,social,80.00,9cmp_003,2026-08-02,search,150.00,24cmp_004,2026-08-02,email,30.00,12cmp_005,2026-08-03,social,95.50,11CSVDo this before the next lesson: the validation contract for Silver is inferred from this file when you create the domain.
4. Read the loader
Section titled “4. Read the loader”dlt/marketing_platform.py is the Bronze loader. It reads each resource’s CSV
from examples/ through dlt, writes it to the Bronze bucket under the
marketing_platform prefix, and returns the row count, the bronze_uri and
the source_file to Dagster, which shows them on the asset. Its core is one
call:
return load_entities_to_bronze( entities=entities, raw_dir=raw_dir or _RAW_DIR, bronze_prefix=_BRONZE_PREFIX,)Loading is keyed by source, so every product that needs
marketing_platform.campaigns calls this one loader. Nothing loads yet:
Dagster runs the loader as the first step of a product job, which you create
in lesson 4.
Check it worked
Section titled “Check it worked”olf check contractsIt validates lakehouse_code/governance.yml and every source.yaml against
the project schemas. It prints one [PASS] line per check, including:
[PASS] descriptor_schema_conformance: 4 descriptor(s) validatedWhat you learned
Section titled “What you learned”olf source newscaffolds a source-owned Bronze package: a descriptor, a dlt loader and example data.- Descriptors stay provider-neutral; OpenLakeForge derives physical names.
- Bronze fills when a product job runs.
Validate into Silver: declare what a valid row looks like.
Synced from openlakeforge @ v0.6.0-alpha.3 (882b426), docs/tutorial/02-ingest-a-source.md.