---
title: "How Hamlet uses Databricks Lakebase Postgres to test changes against production data"
description: "Hamlet, an AI platform indexing meetings from over 7,200 local government bodies, uses Databricks Lakebase Postgres to give each pull request its own branch of production data. This approach lets engineers and AI coding agents like Claude and Codex test data pipeline changes against the exact data that caused a bug without any risk to production. Previously, the small team spent 15 to 30 minutes per pull request staging data and up to several hours weekly cloning data locally, a significant productivity drain. With Lakebase data branching, each preview environment connects to an isolated copy-on-write database where only branch changes consume separate storage, and branches can have an expiration time-to-live for automatic cleanup. A person still approves every merge into production, combining developer speed with human oversight for data pipeline development."
---

# How Hamlet uses Databricks Lakebase Postgres to test changes against production data

[Databricks](https://yomu.fyi/company/databricks) · Sara Steffen · Oct 20, 2026

**Type:** Problem & solution

## Summary

Hamlet, an AI platform indexing meetings from over 7,200 local government bodies, uses Databricks Lakebase Postgres to give each pull request its own branch of production data. This approach lets engineers and AI coding agents like Claude and Codex test data pipeline changes against the exact data that caused a bug without any risk to production. Previously, the small team spent 15 to 30 minutes per pull request staging data and up to several hours weekly cloning data locally, a significant productivity drain. With Lakebase data branching, each preview environment connects to an isolated copy-on-write database where only branch changes consume separate storage, and branches can have an expiration time-to-live for automatic cleanup. A person still approves every merge into production, combining developer speed with human oversight for data pipeline development.

## Context

Hamlet is an AI platform that indexes and transcribes meetings from thousands of local government bodies, making decision-making searchable. The team faced challenges preparing test data for pipeline changes: engineers spent considerable time cloning production data and staging environments. They needed a way to test against production data without risking production, and to enable AI coding agents to run checks in isolated environments.

## Approach / What changed

Hamlet implements a branch-per-pull-request workflow using Databricks Lakebase Postgres. Each time a pull request is opened, a CI pipeline creates a branch from the production database, connecting it to a preview environment. The branch shares storage via copy-on-write, so creation is fast and cheap. Engineers and AI coding agents test against the exact data they need, and branches can be set to expire automatically. When the pull request merges, the branch is deleted.

## Takeaways

- Lakebase Postgres allows each pull request to have its own isolated database branch of production data, enabling developers to test against real data without affecting production.
- Data branching reduces test data preparation time from hours per week to near zero, as the branch is created instantly via copy-on-write and the exact data causing a bug is available.
- AI coding agents can run data pipelines and tests on isolated branches, but a human still approves every merge, maintaining governance over production changes.

## FAQ

### How can you create and automatically delete a Lakebase branch for every pull request?

Add two steps to your CI pipeline: create a branch from production when a PR opens and delete it when the PR merges or closes. Script both steps with the Databricks CLI and run them from a tool such as GitHub Actions. Set an expiration TTL when you create the branch so it deletes itself even if the cleanup step never runs.

### How does database branching work in Postgres?

A Lakebase branch is an independent Postgres environment that starts with the schema and data of its parent and shares storage with it through copy-on-write. Only changes made on the branch are written separately, so creating a branch does not depend on database size. Standard Postgres creates a new database by copying an existing one, which duplicates the data.

### Can AI coding agents test on a Lakebase branch without touching production?

Yes. Each branch is isolated from production, so an agent can apply migrations, run tests and retire the branch when it finishes. A person still approves the merge, and schema changes move to the parent branch through migrations in code rather than by merging the branch.

**Tags:** [AI Agents](https://yomu.fyi/topic/ai-agents), [Database Branching](https://yomu.fyi/topic/database-branching), [Databricks](https://yomu.fyi/topic/databricks), [Postgres](https://yomu.fyi/topic/postgres), [Testing](https://yomu.fyi/topic/testing)

- Source: [Databricks](https://www.databricks.com/blog/how-hamlet-uses-databricks-lakebase-postgres-test-changes-against-production-data)
- Source URL: https://www.databricks.com/blog/how-hamlet-uses-databricks-lakebase-postgres-test-changes-against-production-data
- Ingested by Yomu: 2026-10-20T18:00:14.148Z

[Read original post](https://www.databricks.com/blog/how-hamlet-uses-databricks-lakebase-postgres-test-changes-against-production-data)
