Skip to main content

dbit - Database Schema Version Control

Python Version License: MIT

A Git-like CLI tool for managing database schemas with version control capabilities.

Features

  • Git-like interface for database schema management
  • Support for PostgreSQL, MySQL, and SQLite
  • Schema snapshots and version tracking
  • Schema quality validation
  • Change detection and comparison

Installation

pip install dbit

Using GitHub (Latest)

pip install git+https://github.com/nrnavaneet/dbit.git

From Source (Development)

git clone https://github.com/nrnavaneet/dbit.git
cd dbit
python -m venv venv
source venv/bin/activate
pip install -e .

With Docker

docker pull ghcr.io/nrnavaneet/dbit:latest
# Or build locally for development:
docker build --target development -t dbit:dev .

Usage Example

For a full list of commands and options, run:

dbit help
# or
dbit --help
# or
dbit -h

Common usage:

# Initialize a dbit repository in your project
dbit init

# Connect to your database
dbit connect --db-url postgresql://user:password@localhost/dbname

# Take a schema snapshot
dbit snapshot

# See changes since last snapshot
dbit status

# View schema change history
dbit log

# Run schema quality checks
dbit verify

Commands


Command Description
dbit --help For full list of commands
dbit init Initialize a new dbit repository
dbit connect --db-url <url> Connect to a database
dbit disconnect Disconnect from current database
dbit snapshot [--content N] Create schema snapshot
dbit status [--content N]. Show changes since last snapshot
dbit log Show change history
dbit verify Verify schema quality

Connection Strings

# PostgreSQL
postgresql://user:password@host:port/database

# MySQL
mysql://user:password@host:port/database

# SQLite
sqlite:///path/to/database.db

Configuration

dbit stores configuration in .dbit/schema.yaml:

db: postgresql://user:password@localhost/dbname
migrations: []
current_version: v1.json

Documentation

Contributing

If you want to contribute to dbit, follow these steps:

Quick Developer Setup

Use the provided script to set up your environment:

./scripts/setup-dev.sh

This will:

  • Check your Python version (3.8+ required)
  • Create and activate a virtual environment (venv)
  • Upgrade pip
  • Install all development dependencies
  • Install pre-commit hooks
  • Run pre-commit on all files

After setup, activate your environment with:

source venv/bin/activate

Run tests with:

pytest

Run all pre-commit checks manually with:

pre-commit run --all-files

Manual Setup (Alternative)

  1. Fork the repository
  2. Clone your fork: git clone https://github.com/YOUR_USERNAME/dbit.git
  3. Create a virtual environment and activate it:
    python -m venv venv
    source venv/bin/activate
    
  4. Install development dependencies:
    pip install -e ".[dev]"
    
  5. Install pre-commit hooks:
    pre-commit install
    
  6. Create a feature branch, make your changes, run tests (pytest), and submit a pull request.

Development with Docker

# Build development image
docker build --target development -t dbit:dev .

# Run development container
# Mount your code for live editing
# (from project root)
docker run -it --rm -v $(pwd):/app dbit:dev

License

MIT License - see LICENSE file for details.

Author

N R Navaneet

Metadata

Release files for dbit 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dbit 0.1.1
File Size Uploaded Provenance Actions
dbit-0.1.1.tar.gz 31.7 kB Without provenance Details for dbit-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dbit 0.1.1
File Interpreter ABI Platform Actions
dbit-0.1.1-py3-none-any.whl Python 3 none any Details for dbit-0.1.1-py3-none-any.whl

Total release size: 52.4 kB

Release files / dbit-0.1.1.tar.gz

Download URL dbit-0.1.1.tar.gz
Size 31.7 kB
Tags Source
SHA-256 checksum
How to use checksums
68aae5436b32be732b4927d70adc3635ca41593e793156f88b149a264a186cec
BLAKE2b-256 checksum
How to use checksums
f3beffd49c4519ec8bcc4b0f7a1bba8c54f23f75490c0a9cb9583ff8fbd6a578
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.5

Release files / dbit-0.1.1-py3-none-any.whl

Download URL dbit-0.1.1-py3-none-any.whl
Size 20.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
addec6718130c5049030204b8b35df79a9de97ea3911b8aa1e66e1f81ae7a12a
BLAKE2b-256 checksum
How to use checksums
d62e7b5794ea8d7d3fcea307755955cc5e75ef22c1181131b9e15bd7044ef0cb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.5

Security for dbit 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page