Skip to main content

State-based, cross-engine database deployment — git-driven, parser-assisted, SQL-first.

Project description

dbly — state-based database deployment

Declare your desired database state in git. dbly makes it real.


dbly deploys your database objects — tables, views, functions, procedures, packages, triggers, grants — from version control to PostgreSQL, SQL Server, Oracle and SQLite. You keep one SQL file per object, like normal source code; dbly works out what changed and brings the target database in sync. Think Terraform for your database: declarative, predictable, repeatable.

Why

  • Declarative — your repo is the source of truth. No hand-written migration chains, no version-number collisions on parallel branches.
  • Plan before apply — preview exactly what will run, then execute. No surprises.
  • Idempotent & safe — only the necessary changes are applied. Additive changes go automatically; destructive ones (dropping columns, etc.) are flagged and never run unless you explicitly allow them.
  • Multi-database — one workflow across all four engines.

Install

uv sync                 # PostgreSQL + SQLite work out of the box
uv sync --extra oracle  # add the Oracle driver
uv sync --extra mssql   # add the SQL Server driver
uv sync --extra all     # both

Organize your repo

One file per object; folder names map to database schemas. Use any extension you like (.sql, .tbl, .vw, .prc, …) — dbly reads the SQL to know what each object is.

db/
  sales/
    customer.tbl
    v_open_orders.vw
    grants.sql
  init/                 # optional: privileged greenfield groundwork (CREATE DATABASE/ROLE…)
hooks/pre/  hooks/post/  # optional: .sql or .py hooks (e.g. ArcGIS/ArcPy steps)
.dbignore               # files in the repo that should not be deployed

Connect

A connection profile (reuses the familiar connection.properties format):

environment=postgres            # postgres | sqlserver | oracle | sqlite
service=db.example.com:5432
username=app
password=${DB_PASSWORD}         # ${ENV} placeholders → keep secrets out of the repo (CI/CD-safe)
database=appdb

Use

# preview the changes between the deployed state and a git ref
dbly plan  --to main --target prod.connection.properties

# apply them
dbly apply --to main --target prod.connection.properties

# export a plain SQL script to run by hand (e.g. through a customer VPN, no dbly needed)
dbly plan  --to main --target prod.connection.properties --sql deploy.sql

# what is currently deployed?
dbly status --target prod.connection.properties

# has the database drifted from the desired state?
dbly check  --target prod.connection.properties

# greenfield only: run privileged groundwork once under a superuser profile
dbly init   --init-target super.connection.properties

Typical workflow: edit your object files → commit → dbly plan to review → dbly apply.

Deploying a subset of features is just choosing the git ref you deploy (a release tag or branch). Destructive steps require --allow-destructive.

Built for trunk-based development

Database teams are usually locked out of trunk-based development: migration scripts collide on parallel branches, and "merge" effectively means "deploy to the customer". dbly is designed to break that deadlock for teams who write their logic in SQL, in the database:

  • No migration numbers, no collisions. Two developers edit different objects — git merges them like any other code. Integrate early, every day.
  • Merge ≠ deploy. The trunk is your desired state; dbly apply --to <tag> ships the ref you choose, in the maintenance window you choose. Release what you want, when you want.
  • One trunk, every customer. dbly reads each database's real state, so customers on different versions are no problem.

Integrate continuously, deploy on your own schedule — trunk-based development, finally practical for state-based database developers.

Status

Early alpha — all four engines are implemented and tested against live databases.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dbly-0.0.1.tar.gz (1.5 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dbly-0.0.1-py3-none-any.whl (30.7 kB view details)

Uploaded Python 3

File details

Details for the file dbly-0.0.1.tar.gz.

File metadata

  • Download URL: dbly-0.0.1.tar.gz
  • Upload date:
  • Size: 1.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for dbly-0.0.1.tar.gz
Algorithm Hash digest
SHA256 ca98e8fae69c3c7c9331a8baa9d9b06d4d0a88ef8cc795660160399e1a49b5aa
MD5 183919593a53f6dfad5a2238b0bdc4df
BLAKE2b-256 997ddb8f5c464cc35b8a38efacb4aa0a334ba583d3ad267e255e427b210b1e17

See more details on using hashes here.

Provenance

The following attestation bundles were made for dbly-0.0.1.tar.gz:

Publisher: publish.yml on angrydat/dbly

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file dbly-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: dbly-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 30.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for dbly-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 df1e988b190c83a0634926a994af3286521d7a2b4ee3a6095f0ca51b6e8d9d83
MD5 a850f0891b60fee7b49d1b57b182ffb9
BLAKE2b-256 178163805045108106a0aa4a0003a198ff30bafc35f82fd3eb1adffd3d3d1a0b

See more details on using hashes here.

Provenance

The following attestation bundles were made for dbly-0.0.1-py3-none-any.whl:

Publisher: publish.yml on angrydat/dbly

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page