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 Terraform Provider v1.123.0: Improved Plan Validation, Delta Sharing, MLflow, and Bug Fixes Terraform Databricks Provider Releases ·
- Databricks SDK Java v0.137.0 adds AI Gateway and deployment fields Databricks Java SDK Releases ·
- Databricks SDK for Go v0.166.0 Enhances Workspace Services Databricks Go SDK Releases ·
- NorthStar Anesthesia builds clinician scheduling app on Databricks Apps in weeks Databricks Blog ·
- Databricks AI Search adds high-QPS scaling Databricks Blog ·
- AI Applications and Best Practices in Healthcare Databricks Blog ·