Skip to main content

A Git-like SQLite database management system with branching and multi-tenancy

Project description

CinchDB

Git-like SQLite database management with branching and multi-tenancy

NOTE: CinchDB is in early alpha. This is project to test out an idea. Do not use this in production.

CinchDB is for projects that need fast queries, data isolated data per-tenant or even per-user, and a branchable database.

On a meta level, I made this because I wanted a database structure that I felt comfortable letting AI agents take full control over, safely, and I didn't want to run my own Postgres instance somewhere or pay for it on e.g. Neon - I don't need hyperscaling, I just need super fast queries.

Because it's so lightweight and its only dependencies are pydantic, requests, and Typer, it makes for a perfect local development database that can be controlled programmatically.

uv pip install cinchdb

# Initialize project
cinch init 

# Create and query tables
cinch table create users name:TEXT email:TEXT
cinch query "SELECT * FROM users"

# Git-like branching
cinch branch create feature
cinch branch switch feature
cinch table create products name:TEXT price:REAL
cinch branch merge-into-main feature

# Multi-tenant support
cinch tenant create customer_a
cinch query "SELECT * FROM users" --tenant customer_a

# Connect to remote CinchDB instance
cinch remote add production https://your-cinchdb-server.com your-api-key
cinch remote use production

# Autogenerate Python SDK from database
cinch codegen generate python cinchdb_models/

What is CinchDB?

CinchDB combines SQLite with Git-like workflows for database schema management:

  • Branch schemas like code - create feature branches, make changes, merge back
  • Multi-tenant isolation - shared schema, isolated data per tenant
  • Automatic change tracking - all schema changes tracked and mergeable
  • Safe structure changes - change merges happen atomically with zero rollback risk (seriously)
  • Remote connectivity - Connect to hosted CinchDB instances
  • Type-safe SDK - Python and TypeScript SDKs with full type safety
  • Remote-capable - CLI and SDK can connect to remote instances
  • SDK generation from database schema - Generate a typesafe SDK from your database models for CRUD operations

Installation

Requires Python 3.10+:

pip install cinchdb

Quick Start

CLI Usage

# Initialize project
cinch init my_app
cd my_app

# Create schema on feature branch
cinch branch create user-system
cinch table create users username:TEXT email:TEXT
cinch view create active_users "SELECT * FROM users WHERE created_at > datetime('now', '-30 days')"

# Merge to main
cinch branch merge-into-main user-system

# Multi-tenant operations
cinch tenant create customer_a
cinch tenant create customer_b
cinch query "SELECT COUNT(*) FROM users" --tenant customer_a

Python SDK

import cinchdb
from cinchdb.models import Column

# Local connection
db = cinchdb.connect("myapp")

# Create schema
db.create_table("posts", [
    Column(name="title", type="TEXT",nullable=False),
    Column(name="content", type="TEXT")
])

# Query data
results = db.query("SELECT * FROM posts WHERE title LIKE ?", ["%python%"])

# CRUD operations
post_id = db.insert("posts", {"title": "Hello World", "content": "First post"})
db.update("posts", post_id, {"content": "Updated content"})

Remote Connection

# Connect to remote instance
db = cinchdb.connect("myapp", url="https://your-cinchdb-server.com", api_key="your-api-key")

# Same interface as local
results = db.query("SELECT * FROM users")
user_id = db.insert("users", {"username": "alice", "email": "alice@example.com"})

Remote Access

Connect to a remote CinchDB instance:

cinch remote add production https://your-cinchdb-server.com your-api-key
cinch remote use production
# Now all commands will use the remote instance

Interactive docs at /docs, health check at /health.

Architecture

  • Python SDK: Core functionality (local + remote)
  • CLI: Full-featured command-line interface
  • Remote Access: Connect to hosted CinchDB instances
  • TypeScript SDK: Browser and Node.js client

Development

git clone https://github.com/russellromney/cinchdb.git
cd cinchdb
make install-all
make test

Future

Though probably not, perhaps I'll evolve it into something bigger and more full-featured, with things like

  • data backups
  • replication to S3
  • audit access
  • SaaS-like dynamics
  • multi-project hosting
  • auth proxying
  • leader-follower abilities for edge deployment

License

Apache 2.0 - see LICENSE


CinchDB - Database management as easy as version control

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

cinchdb-0.1.2.tar.gz (60.0 kB view details)

Uploaded Source

Built Distribution

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

cinchdb-0.1.2-py3-none-any.whl (85.8 kB view details)

Uploaded Python 3

File details

Details for the file cinchdb-0.1.2.tar.gz.

File metadata

  • Download URL: cinchdb-0.1.2.tar.gz
  • Upload date:
  • Size: 60.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.0

File hashes

Hashes for cinchdb-0.1.2.tar.gz
Algorithm Hash digest
SHA256 06a663d907613a8da2ae6618150cd64d5b931612de2d9b804899e0f12be86cd2
MD5 5f149f2e1d56822d38acc99a49d6dd78
BLAKE2b-256 c957b6b1aa20567b2b793bb9b381db0f7520bd5ebd7364aee96b682a50ce1c6f

See more details on using hashes here.

File details

Details for the file cinchdb-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: cinchdb-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 85.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.0

File hashes

Hashes for cinchdb-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7f112a38844bf5ec8403ee7d8b76d9f8734e9a0475175ed81aaad39a4e63bc4f
MD5 a40fa4f36d1077d5bb1b3fd31985ee2d
BLAKE2b-256 49165221d56fc3c195225f2056f5716cddb066dcbe14ca8b29b6616a637fa695

See more details on using hashes here.

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