Skip to content

mgramin/database-as-code

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 

Repository files navigation

The "Database as Code" Manifesto

We believe that we can interact with our databases and storage (including queries, administration and the entire DB lifecycle) as if they were plain code. And we call it - "Database as Code" (such as "infrastructure as code", "configuration as code", "pipeline as code" and so on).

Base principles:

  • All changes and operations with the database and all queries (ideally) against the database should be expressed as a plain old code
  • Git (or anything else VCS) is a single source of truth for database code
  • SQL actually is a main database language supported by almost all DBMS
  • SQL is not a bytecode for your data and your database, it's a normal human-oriented program language (why)
  • SQL is designed not only for data, but also for metadata
  • Database code is not only DDL and other migration scripts, DML and all kinds of SQL scripts too
  • Database code is a normal code, and it also needs static analysis, code review (especially by DBA, analysts and business people) , tests and automation of it all
  • DBAs and data people should be integrated with Dev and Ops
  • Ability to release on demand.

Resources:

Talks:

  • Aren't we forgetting someone? (slides)
  • Database as Code. Not only migrations (video, slides)

Tools:

  • Liquibase - database schema change management solution and standard realization of Refactoring Databases patterns.
  • dbt - enables data analysts and engineers to transform their data using the same practices that software engineers use to build applications.
  • Yesql - a Clojure library for using SQL. Keep the SQL as SQL.
  • HugSQL - a Clojure library for embracing SQL, creating a clean separation of Clojure and SQL code.
  • PugSQL - Python library inspired by HugSQL.
  • Malewicz - Hackable GUI SQL-manager written in SQL itself.
  • Pigsty - Describe database with code, then create them in one-click.
  • Bytebase - Safer and faster database change and version control for teams.
  • aiosql - SQL is code. Write it, version control it, comment it, and run it using files.
  • Synthesized - Create high-quality data for machine learning, application development and testing with easy-to-use config files.
  • Evidence - Build a polished business intelligence system using only SQL and markdown.
  • Soda - Check Data As Code.