Branching Lakebase databases like code for CI/CD
Glaspoort implemented a CI/CD pattern for their Databricks Lakebase, treating database changes with the same rigor as application code. This involves branching every environment directly from production and using ephemeral per-PR databases, with migrations as the single source of truth. This approach aims to avoid the common "reset-from-parent trap" that causes environments to drift from production and necessitates costly rebuilds. The pattern allows for faster, more reliable database updates in production environments.
- →Branching strategy to avoid environment drift
- →Ephemeral per-PR database branches
- →Migrations as the source of truth
- →Glaspoort's CI/CD pattern for Lakebase databases
- →Two promotion models for database changes
Features (3) ›
- Branching strategy to avoid environment drift
The core of the design involves branching development and acceptance environments directly from production, rather than stacking them sequentially. This strategy, termed the "reset-from-parent trap," aims to prevent development and acceptance databases from drifting away from the production state.
- Ephemeral per-PR database branches
Each pull request gets its own disposable Lakebase branch, copied from production. Migrations are then replayed and tested against a live application image before any changes are applied to a production environment.
- Migrations as the source of truth
Database migrations are treated as the definitive source of truth within this CI/CD workflow. This ensures consistency and reliability in how database changes are applied and managed across different environments.
Enhancements (1) ›
- Two promotion models for database changes
The article discusses a tradeoff between two promotion models: merging as soon as CI passes versus merging only after a PR has been fully promoted through acceptance. Glaspoort opted for a "velocity first" approach, implementing safeguards like stack revalidation and a crisis pipeline.
Notes (2) ›
- Glaspoort's CI/CD pattern for Lakebase databases
Glaspoort developed a system to manage Databricks Lakebase database changes using a CI/CD pattern similar to application code. This involves branching each environment directly from production and creating ephemeral per-pull request (PR) databases.
- Lakebase as an OLTP database for applications
Glaspoort utilizes Databricks Lakebase, described as serverless Postgres OLTP, running alongside their lakehouse. This setup allows curated data from the lakehouse to be synced into a production Lakebase branch for application use.
https://www.databricks.com/blog/branching-databases-code-cicd-pattern-lakebase-production-glaspoort
Related releases
- Building an AI-Forward Healthcare Organization on Data and Governance Databricks Blog ·
- Databricks Accelerates Agentic Media Buying with New Reference Implementation Databricks Blog ·
- NBCUniversal Migrates to Databricks Lakehouse for Scalable Analytics Databricks Blog ·
- Databricks SDK for Python v0.123.0: API changes and breaking updates Databricks Python SDK Releases ·
- Databricks Go SDK v0.167.0 Adds Cloud Provider Auth Fields Databricks Go SDK Releases ·
- Databricks SDK Java v0.138.0 Adds Model Provider Config Fields Databricks Java SDK Releases ·