# I built an end-to-end Databricks lakehouse on Free Edition. Here’s the whole project, in plain English

For a while I’d been reading about lakehouses, Unity Catalog and Databricks bundles without ever putting them together myself. Tutorials usually stop once a notebook runs. I wanted the full picture: getting data in, cleaning it, serving it, protecting it, and deploying it like a real team would.

So I built a small sales analytics project on Databricks Free Edition, with my own S3 bucket, a free Salesforce Developer org and GitHub. Everything here was tested in November 2026.

![](https://cdn.hashnode.com/uploads/covers/676bd2540c14242a25cfaa73/b58a3c6f-0822-46f0-b3d2-9f5b43071557.png align="center")

**Want every detail?** I also published the full interactive guide, with checklists for each step: [Open the interactive guide](https://matifhafeez.github.io/sales-lakehouse-guide/)

## The project in one minute

Customer data comes from Salesforce, and orders and website activity arrive as files in S3. Everything flows through three layers. **Bronze** keeps the raw data exactly as it arrived. **Silver** cleans it, fixes types, sets bad rows aside and tracks how customers change over time. **Gold** holds the ready-made numbers a dashboard needs.

One scheduled job runs the whole flow whenever new files arrive. Access rules hide personal data such as customer emails. All the code lives in GitHub, and the same code deploys to a test environment and a production environment, where it runs under a dedicated robot account instead of my own login.

## The build, step by step

Click any step to expand it.

### Setting up

<details><summary>1. Check that every piece works before building</summary>
I confirmed Databricks could read and write my S3 bucket, that the Salesforce connector was available, and that my free Salesforce org had data. Free Edition has real limits (serverless compute only, one small SQL warehouse, at most five tasks running at once), so I checked those first. Several design choices later came straight from these limits.
</details>

<details><summary>2. Organize the data catalog</summary>
Unity Catalog is Databricks’ way of organizing and securing data. I created one catalog for the project, with four schemas: bronze, silver, gold, and ops for housekeeping. I set the catalog’s storage location when I created it, because Free Edition wouldn’t let me change it afterwards. Incoming files land in a folder that lives outside Databricks’ control, so deleting it in Databricks never deletes the source files. Databricks’ own internal bookkeeping lives in a folder it fully manages.
</details>

<details><summary>3. Prepare small, deliberate test data</summary>
About ten customers in Salesforce, plus three batches of files. The first batch is normal, the second adds a new column, and the third contains deliberately bad rows: an amount of “N/A”, a negative amount, a missing ID and a duplicate. Small data, chosen so I could watch every feature do its job.
</details>

### Bronze: getting data in

<details><summary>4. Pull Salesforce data with a managed connector</summary>
Databricks has a ready-made Salesforce connector, so there’s no code to write. It loads Accounts, Contacts and Opportunities incrementally, only fetching what changed. One catch: it keeps only the latest version of each record. When a customer moved from Dubai to Abu Dhabi, the old city simply disappeared, which is why history has to be built later, in silver.
</details>

<details><summary>5. Load files automatically with Auto Loader</summary>
Auto Loader picks up new files as they land and remembers which ones it has already processed, so running it twice never duplicates data. Bronze tables are append-only: rows can be added but never changed. When the new column appeared in batch two, Auto Loader stopped once on purpose, recorded the new column, and carried on when restarted. That’s intended behavior, and a job retry handles it automatically.
</details>

### Silver: cleaning and modeling

<details><summary>6. Clean the orders and set bad rows aside</summary>
Each new batch is split. Good rows go into the clean orders table, and bad rows go into a quarantine table, so nothing is lost and nothing breaks the load. A database rule (amount must be zero or more) acts as a safety net: if bad data ever slips past my code, the write fails loudly instead of quietly corrupting the table. The whole process is safe to repeat, so a retry never creates duplicates.
</details>

<details><summary>7. Keep customer history (SCD Type 2)</summary>
Instead of overwriting a customer’s city, I keep every version with “valid from” and “valid to” dates. Orders are matched to the version that was true when each order was placed, so October’s revenue stays with Dubai even after the customer moved. One subtle fix: the first version of each customer starts in 1900, otherwise older orders matched no version and silently vanished from reports.
</details>

<details><summary>8. Compare ways of laying out data on disk</summary>
How data is split into files decides how much a query has to read. I tried three approaches side by side: old-style partitioning by date, liquid clustering on chosen columns, and automatic clustering where Databricks picks the columns itself. Partitioning a small table created 21 tiny files. After converting it to liquid clustering and running a full optimize, it became a single file, about twelve times smaller.
</details>

<details><summary>9. Make joins efficient without tuning knobs</summary>
On serverless, Databricks manages most performance settings for you. So instead of tweaking configuration, I made design decisions, such as telling Spark to copy the small customer table to every worker for joins, and then checked the query plan to confirm it worked.
</details>

### Gold: serving the numbers

<details><summary>10. Pre-compute the dashboard numbers</summary>
Materialized views store query results and refresh them, ideally processing only what changed. I watched three behaviors in the logs: a full rebuild the first time, no work at all when nothing had changed, and a partial refresh of only the affected days when new orders arrived. Each refresh still has a startup cost of about a minute, so I only refresh when there’s new data.
</details>

<details><summary>11. Build and share a dashboard</summary>
The dashboard reads only from gold, so it stays fast and cheap. When sharing, you choose whether viewers see data through the publisher’s permissions or through their own. That choice matters as soon as some data is restricted.
</details>

### Running it

<details><summary>12. Run everything with one job</summary>
One Lakeflow Job runs the Salesforce sync and the file loading in parallel. It then checks whether there’s anything new, and skips the cleaning steps when there isn’t. It refreshes gold and writes a log entry on every run, even after a failure. It starts automatically when new files land. My first “is there new data?” check always said no on serverless compute. Comparing the latest load time in bronze with silver fixed it, and it now recovers on its own after a failed run.
</details>

<details><summary>13. Protect personal data</summary>
First I hid customer emails the manual way, adding a rule table by table. Then I replaced that with a tag-based policy (ABAC): tag a column as “email”, and a single policy for the whole catalog masks it everywhere. New tables are protected the moment their email column is tagged, with no extra setup.
</details>

### Shipping it like a team

<details><summary>14. Put the code in GitHub</summary>
Databricks Git folders connect the workspace to GitHub. Every change went through a branch, a commit and a pull request, so it was reviewed before reaching the main branch.
</details>

<details><summary>15. One codebase, two environments</summary>
Declarative Automation Bundles describe the job and its code as files. The same files deploy to a dev catalog and a prod catalog; only a few settings differ. An interesting finding: dev ran the live files in my workspace, including unsaved edits, while prod ran frozen copies taken at deploy time. That’s exactly what you want from each.
</details>

<details><summary>16. Automatic deployment with GitHub Actions</summary>
Production isn’t deployed by me. GitHub Actions does it, running as a service principal (a robot account) with only the permissions the job needs. Production then keeps working if I’m away or my access changes. One painful lesson: a narrowly scoped secret looked safer, but the Databricks CLI couldn’t log in with it. The robot account’s own limited permissions turned out to be the real safety boundary.
</details>

### Looking after it

<details><summary>17. Monitor and optimize</summary>
The job’s run history showed where time actually went: mostly start-up, not data. Based on that, I converted the last partitioned table and switched the job to a cheaper performance mode, which starts slower but costs less, since nobody waits for this job to finish.
</details>

<details><summary>18. Review costs and clean up</summary>
I paused the automatic trigger so nothing runs unattended, and wrote down a teardown order. Deleting the Salesforce pipeline also deletes its tables, so it comes late in the list.
</details>

## What I’d tell someone starting out

- Check every feature in your own workspace before designing around it. Free Edition did more than I expected, and a few things worked differently from the docs.
- Design for failure: make every step safe to rerun, keep bad data instead of dropping it, and base decisions on what’s actually in your tables.
- Production should belong to a robot account with exactly the permissions it needs, never to a person.

## Build your own with this prompt

I built this step by step with an AI assistant, checking everything against the official Databricks docs as I went. If you want to try the same, here’s the prompt I’d start with. It works with Claude or any capable AI assistant; just fill in the brackets.

```text
You are my Databricks mentor. Help me build an end-to-end lakehouse project, one step at a time, to learn
the topics in the current Databricks Certified Data Engineer Associate exam guide.

My setup:
- Databricks Free Edition (serverless only)
- My own cloud storage: [S3 bucket / ADLS / GCS], already connected as a Unity Catalog external location
- A free SaaS source: [Salesforce Developer Edition, or suggest another supported by Lakeflow Connect]
- A GitHub account

What to build (sales analytics scenario):
1. Unity Catalog: one catalog with a managed location; schemas bronze, silver, gold and ops;
   an external volume for landing files and a managed volume for Auto Loader state.
2. Bronze: ingest the SaaS source with a Lakeflow Connect managed connector, and ingest CSV/JSON files
   with Auto Loader into append-only Delta tables, with schema evolution.
3. Silver: clean and type the data, route bad rows to a quarantine table, add constraints,
   and build an SCD Type 2 customer dimension with MERGE.
4. Facts: one partitioned table as a contrast, one with liquid clustering on chosen keys,
   one with CLUSTER BY AUTO. Later, convert the partitioned one and compare file counts.
5. Gold: materialized views (with expectations and a refresh policy) and one standard view.
6. An AI/BI dashboard reading gold only.
7. One Lakeflow Job: the ingestion pipeline task, notebook tasks, an If/else gate on new data,
   a For each loop, retries, a SQL task to refresh gold, and an audit task that always runs.
8. Governance: a manual column mask and row filter first, then an ABAC policy with a governed tag.
9. Git folders and pull requests, then Declarative Automation Bundles with dev and prod targets
   (separate catalogs), and GitHub Actions deploying prod as a service principal.
10. Monitoring and optimization, then a cost review and teardown plan.

How to work with me:
- Ground every claim in the official Databricks docs (docs.databricks.com). Check the current docs
  for each step rather than relying on memory, and say clearly when something isn’t confirmed.
- Check the Free Edition limitations page first, and adapt the design to its limits.
- One step at a time: explain what and why in plain language, list the actions, tell me the expected
  result, and ask me for evidence (screenshots or output) before moving on.
- Focus on architecture, cost and performance. Keep code short and explain it.
- Point out exam-relevant traps as we go.
- Never ask me for passwords, tokens or secrets.
- At the end, quiz me on the concepts and turn my weak areas into flashcards.
```

If you try it, I’d love to hear how far you get, and what broke along the way. That’s where most of the learning happened for me.
