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
- Databricks restricts UI disabling of partner-powered AI features Databricks Release Notes ·
- Databricks to remove partner-powered AI features setting toggle Databricks Release Notes ·
- Sharing Foreign Schemas and Tables with OpenSharing is Generally Available Databricks Release Notes ·
- Databricks OpenSharing now generally available for foreign Iceberg tables Databricks Release Notes ·
- Databricks Lakeflow Connect Unifies Marketing Data with Managed Connectors Databricks Blog ·
- Databricks and Abacus Insights Power AI for Health Plan MLR Analysis Databricks Blog ·