Claude Code builds the silver and gold layers in Microsoft Fabric

Claude Code built a generic silver engine and a Kimball gold layer in Fabric, tested SCD Type 2 on its own and reconciled every total. I wrote no code.

In this article 8 sections
  1. What silver has to do
  2. What Claude built for silver
  3. Deploying and verifying in Fabric
  4. Inside the silver lakehouse
  5. On to gold, and a real bug
  6. What gold looks like
  7. Querying the gold SQL analytics endpoint
  8. My verdict

I planned to let Claude Code build the silver layer this week. It went so fast that I let it carry on into gold, and by the end there were six dimensions, two fact tables and totals that reconcile with both sources. I didn’t write a single line of code. I just steered it along.

This is part four of my series on whether AI can replace a Fabric data engineer. In part three Claude built the landing and bronze layers for Adventure Works (Azure SQL) and Moneybird (a REST API). Bronze ended with Moneybird records stored as a JSON string, so the first question for silver was what Claude would do with those.

An AI Agent Just Built My Entire Fabric Warehouse Watch on YouTube

What silver has to do

Phase 5 of Claude’s plan covers silver, and there’s quite a lot in it:

  • projection and casting of data types, and snake casing of the column names
  • deduplication on the latest version of each record
  • a “child explode” for the invoice details and payments
  • PII masking
  • merging, with soft deletes
  • schema drift detection and logging
  • silver metadata for all entities, plus data quality rules (unique keys and foreign keys within each source), with the results written to a control table

Child explode sounds way more horrifying than it is. The Moneybird tables in bronze hold nested JSON objects, and those get exploded into their own rows and columns.

The capacity was paused, so I resumed tfg01 in the Azure portal, told Claude “yes, start silver” and hoped that would be my job for the day.

What Claude built for silver

Silver was done really fast. Claude built a silver engine in src/tfg_platform/layers/silver.py, built and tested locally but not yet committed or deployed. The engine:

  • projects and casts each source’s columns and renames them to snake_case
  • keeps the latest bronze record per key
  • explodes the invoice details and payments into child tables
  • masks PII with a SHA-256 digest, or drops the column if you configure that
  • merges only the rows that changed, so a second run writes nothing and creates no Delta commit

A Moneybird tombstone (a deleted record) sets Sys_IsDeleted = true and keeps the last known attributes, and child rows are soft-deleted when their parent is deleted. A missing expected SQL column fails the run, while unmapped source fields are logged once in ctl.schema_drift. The data quality rules are not_null, unique, fk and accepted_values, with results in ctl.dq_result.

Before the first Fabric run it gave me a list of things to check. The Moneybird column names came from its knowledge of the API, with no real records to check against, so any wrong field would show up as null. Cross-entity foreign keys (invoice to contact, for example) only raise a warning; unique keys and parent foreign keys are errors. And it had only run the tests on Python 3.13 locally, while Fabric runs 3.10. That last one bit us last week, so it’s good it flagged it. Then it asked whether to commit, open the PR and run in Fabric. Yes, do all of that please.

Deploying and verifying in Fabric

Claude deployed the silver code and ran it over the existing bronze data. Along the way an error scrolled past about a missing requests module, and for a moment the SQL analytics endpoint showed nothing. Claude worked out that the silver tables and the data quality results did exist in the lakehouse and that the endpoint was simply lagging, so it re-queried.

Then it did what I would do: count the records, reconcile the invoice totals, and run everything a second time to check it’s idempotent and safe to rerun.

Claude's check table for silver: 16 tables built with row counts equal to the bronze distinct keys, Moneybird invoice totals of 1,996,272.33 matching the invoice lines, a second run writing 0 rows, 34 data quality rules passed, a soft delete showing Sys_IsDeleted = 1, the nb_load_silver step in pl_orchestrator and AdventureWorks email and phone hashed
All five done-when checks from the plan passed
CheckResult
Silver run16 tables, all succeeded; row counts equal the bronze distinct keys (customers 847, order lines 3,289, Moneybird invoices 806, invoice lines 3,208)
TotalsMoneybird invoice totals excluding tax (1,996,272.33) equal the sum of the invoice lines
IdempotentA second run wrote 0 rows across all 16 tables
Data quality34 rules ran and all passed
Soft deleteA contact deleted in the test administration shows up in silver as Sys_IsDeleted = 1, attributes kept
PIIAdventureWorks email and phone are now hashes

It also flagged two things. The sales_invoice_payments table is empty because every invoice is late with nothing paid. A draft invoice appeared in the test administration that Claude didn’t create, and it has no invoice ID yet, which gold would need to handle. Both are true: I only registered the invoices in Moneybird and did no accounting on them.

Inside the silver lakehouse

In the Fabric monitor the bronze and silver notebooks had all succeeded. The silver lakehouse has a schema per source system, adventureworks and moneybird, and the data looks like what you’d expect: addresses, customers, products and so on. Every table carries a run ID, a load timestamp, an active flag, a record hash and an is-deleted flag. For Moneybird, the JSON from bronze is now expanded into proper tables, including sales_invoice_details. That’s the part I was curious about last week, and this is looking good.

What’s missing is valid from and valid to dates. There’s only a load timestamp and an active flag. So there can be plenty of records that are no longer active, and we don’t know in what order they used to exist, unless we go by the load timestamp. I think that’s a weak proxy for validity, so this isn’t 100% right.

The load notebook and the Python wheel

The nb_load_silver notebook is short. Claude packaged its code as a Python wheel, tfg_platform, which the notebook pip installs from the control lakehouse storage (Files/libs). The rest of the notebook loads the platform config and calls the silver layer from that package. So the logic sits in the wheel, and the notebook only kicks it off.

The control lakehouse

The control lakehouse lh_control sits in the 00_platform folder. Its dbo schema is empty, and the ctl schema has the tables Claude writes to:

  • watermark: when each table was last loaded
  • task_run: every task or activity that ran during the ETL process
  • schema_drift: the fields that changed, logged on the first run
  • dq_result: one row per data quality rule, with its severity and status

A rule with severity error fails the run once every rule has been logged; a warn only reports. Here the status is passed for all of them.

On to gold, and a real bug

I said this one would be about silver. But with how fast it was going, I asked Claude to dive straight into gold and see how far it could get.

It ran for a while, building the model configuration and a generic engine for dimensions and facts with slowly changing dimensions. Then it reported that everything had built correctly, but the idempotent rerun had failed: “That’s a real bug.” The nb_build_models run in Fabric failed the second time with “cannot unpack Series of type object into a bool”. I suspected something with creating tables that already existed. Claude pulled the traceback and found a polars type error that only showed up in Fabric, even though it passed locally. It fixed it, and the rerun wrote 0 rows.

Claude tests SCD Type 2 by itself

Claude decided on its own that the salesperson on a customer should be slowly changing dimension Type 2: a change creates a new version of the record with a start and end date, instead of overwriting the old one. To prove it works, it temporarily changed one customer’s salesperson in silver and checked that gold created a new version. The old version closed, and the existing facts kept pointing at it. Then it restored silver, cleared the test data from gold, rebuilt and ran the full pipeline.

I didn’t ask for that test. It’s actually very smart.

What gold looks like

The full pl_orchestrator run, from copy through bronze, silver and gold, succeeded end to end.

Claude's gold summary: six dimensions with an Unknown row each, fct_sales_order_line with 3,289 rows and fct_invoice_line with 3,208 rows, 842 of 847 customers matched to Moneybird contacts, checks against the sources and things to know such as the polars bug only Fabric showed
What Claude built in lh_gold.dwh, and how it checked it
  • Dimensions: dim_date, dim_customer, dim_product, dim_address, dim_order_profile and dim_invoice_profile. Each has an “Unknown” row, so no foreign key is ever empty. Claude added dim_order_profile (status, online or offline, ship method) even though it wasn’t in the plan.
  • Facts: fct_sales_order_line (3,289 rows) and fct_invoice_line (3,208 rows). That makes sense: that’s the data we have, and there are a few more order lines than invoice lines because you create an order, ship it and then invoice it. Not every order has shipped yet.
  • Customer link: integration.customer_xref matches Adventure Works customers to Moneybird contacts. 842 of the 847 match. The other five only exist in Adventure Works and stay in dim_customer.
  • Pipeline: nb_build_models runs after silver in pl_orchestrator, and each model is a SQL query plus a YAML file in metadata/models/.

The checks against the sources pass as well: the gold sales total equals the Azure SQL source, the invoice totals match Moneybird, all 70 quality rules pass and no fact points at an Unknown customer or product. Claude also found that every Moneybird invoice’s reference holds an Adventure Works sales order number, a link its own design said didn’t exist, so both facts now carry that number.

Querying the gold SQL analytics endpoint

Time to look for myself, through the SQL analytics endpoint of lh_gold. The tables live in a dwh schema.

dim_customer has Sys_ValidFrom and Sys_ValidTo, the validity dates that silver didn’t have, plus a sys ID, a record hash and a run ID that’s a UTC timestamp.

fct_invoice_line has the typical Moneybird invoice numbers, with multiple rows per invoice for the invoice lines. Each invoice links to a reference, which is the sales order number from Adventure Works. The amounts are all there: quantity, unit price, the amount excluding tax (quantity times unit price), the tax amount at 21% Dutch VAT, the amount including tax and the outstanding amount. Then a set of foreign keys to the dimensions: invoice_date_Sys_ID, customer_Sys_ID, product_Sys_ID and so on.

The concept works. But does it actually work? A quick join between the invoice lines and the customers:

SQL
select cu.contact_name, il.*
from dwh.fct_invoice_line il
left join dwh.dim_customer cu
    on il.customer_Sys_ID = cu.Sys_ID
The join query in the lh_gold SQL analytics endpoint, with results showing contact names such as John Emory and Gladys Mendiola next to their invoice numbers and sales order references
Invoice lines joined to dim_customer: every line gets a contact name

Every invoice line gets its customer. In practice this join will be a relationship in the Power BI semantic model, but it’s always nice to check that it works.

My verdict

I’m very optimistic about this. There are a few things I would have done differently, especially naming conventions and some technical details, like the missing validity dates in silver. But overall it’s a pretty solid job.

If you have the technical knowledge of a data engineer, this will make your life so much easier and quicker. If you’re an end customer, I would not recommend building a platform like this: pro code, with a Python library and so on. If you can’t fix or troubleshoot things yourself, that might get difficult. For data engineers, SQL professionals and data scientists, I think vibe coding is a very good thing to do.

If you have technical knowledge as a data engineer, this will make your life so much easier, so much quicker.

There will be tooling around vibe coding: harnesses, processes and so on to make this even easier. But working with plain Claude Code, it’s already quite good. I’m impressed.

In part five, Claude builds the semantic model and the Power BI report on top of this gold layer, the same way.

Bas Land · Microsoft Data Platform MVP

Bas has spent more than 12 years in the Microsoft data stack. He builds data platforms on Microsoft Fabric, teaches as a Microsoft Certified Trainer and speaks at conferences such as Power BI Gebruikersdagen.

↑↓to move ↵to open escto close