Skip to main content

Database sync tool for developers

Project description

dbsyncx

Sync and backup databases like Git.


What is dbsyncx?

dbsyncx is a developer-first CLI that makes it easy to:

  • Sync databases between environments
  • Create backups instantly
  • Avoid complex pg_dump commands
  • Work safely with production data

Think of it as:

Git-style workflow for your database


Why dbsyncx?

If you've ever:

  • Needed to debug production locally
  • Run risky migrations without a backup
  • Forgotten pg_dump flags
  • Accidentally overwritten the wrong DB 😅

Then dbsyncx is for you.


Features

  • Sync databases (pull / push)
  • One-command database backups
  • Restore from backup dumps
  • Schema-only syncs and backups
  • Table-specific syncs and backups
  • Built-in safety confirmations
  • Dry-run mode (preview actions)
  • Clean YAML configuration
  • Adapter-based architecture
  • Fully local (no cloud required)

Example

Pull production → local

dbsyncx pull production local
This will overwrite 'local'. Continue? [y/N]:
12:41:03 | INFO | Pulling database: production -> local
12:41:05 | INFO | Dumping source database
12:41:07 | INFO | Restoring into target database
✔ Pull complete

Create a backup

dbsyncx dump production
✔ Dump created: dbsyncx_production_20260427_125102.dump

Installation

Requirements

Make sure PostgreSQL tools are installed:

pg_dump --version
pg_restore --version
psql --version

Install

pip install dbsyncx

Or from source:

pip install -e .

Verify

dbsyncx version
dbsyncx is at version 1.2.1

Quick Start

1. Initialize

dbsyncx init

2. Configure

Edit:

.dbsyncx/config.yaml
project_id: my-project

databases:
  local:
    url: postgresql://localhost:5432/mydb

  production:
    url: postgresql://user:password@host:5432/mydb

3. Test connection

dbsyncx status local

4. Sync database

dbsyncx pull production local

Commands

Initialize config

dbsyncx init

Pull database

dbsyncx pull <source> <target>

Options:

--force, -f       Skip confirmation
--dry-run         Simulate without executing
--schema-only     Sync schema objects only
--table, -t       Limit sync to a table. Repeat for multiple tables

Examples:

dbsyncx pull production local --schema-only
dbsyncx pull production local --table public.users --table audit_log

Push database

dbsyncx push <source> <target>

Options:

--force, -f       Skip confirmation
--dry-run         Simulate without executing
--schema-only     Sync schema objects only
--table, -t       Limit sync to a table. Repeat for multiple tables

Examples:

dbsyncx push local staging --schema-only
dbsyncx push local staging --table public.users

Dump database (backup)

dbsyncx dump <database>

Options:

--output, -o      Custom output file
--dry-run         Simulate without executing
--schema-only     Dump schema objects only
--table, -t       Limit dump to a table. Repeat for multiple tables

Examples:

dbsyncx dump production --schema-only
dbsyncx dump production --table public.users --output users.dump

Restore database

dbsyncx restore <database> <dump-file>

Options:

--force, -f       Skip confirmation
--dry-run         Simulate without executing
--schema-only     Restore schema objects only
--table, -t       Limit restore to a table. Repeat for multiple tables

Examples:

dbsyncx restore local production.dump
dbsyncx restore local users.dump --table public.users

Restore uses pg_restore --clean --if-exists, so matching target objects can be dropped and recreated during restore without failing on empty targets.


Check connection

dbsyncx status <database>

Version

dbsyncx version

Safety Features

dbsyncx protects you by default:

  • Prompts before overwriting databases
  • --force to skip confirmation
  • --dry-run to simulate actions

Security

  • Runs entirely locally
  • No credentials leave your machine
  • No cloud dependency
  • Uses native PostgreSQL tools

How it works

dbsyncx uses:

  • pg_dump → export database
  • pg_restore → restore database

No magic — just safer workflows.


Architecture

Adapter-based design:

Current:

  • ✅ PostgreSQL

Future:

  • MySQL
  • SQLite
  • MongoDB

Roadmap

v1.0.0

  • CLI sync tool
  • Backup support
  • Safety features

v1.1.0

  • Added support for running dbsyncx in local, Docker, and crontab environments.
  • Refactored configuration loading to work seamlessly across all supported execution environments.

v1.2.1 (Current)

  • Schema-only sync
  • Table-specific sync
  • Restore from dump files

v1.3.0

  • Cloud dashboard
  • Sync history

v2.0.0

  • Multi-database support

Development

git clone https://github.com/yourusername/dbsyncx
cd dbsyncx

pip install -e .[dev]
pytest

Contributing

Contributions welcome.

Open issues or PRs.


License

MIT


Support

If you find this useful:

  • ⭐ Star the repo
  • Share with your team
  • Suggest features

Coming Soon

Optional cloud dashboard for:

  • Sync monitoring
  • Scheduled backups
  • Team workflows

CLI will always remain free.


Built for developers who are tired of database headaches.

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

dbsyncx-1.2.1.tar.gz (12.9 kB view details)

Uploaded Source

Built Distribution

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

dbsyncx-1.2.1-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

Details for the file dbsyncx-1.2.1.tar.gz.

File metadata

  • Download URL: dbsyncx-1.2.1.tar.gz
  • Upload date:
  • Size: 12.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.4

File hashes

Hashes for dbsyncx-1.2.1.tar.gz
Algorithm Hash digest
SHA256 5aff06d875212bf66328a7dbc9bb7dfc0f9cbd8555667a7384dd7cf967f34018
MD5 4299314e2e653546e225e56272e2bd76
BLAKE2b-256 9b6035a72a9615fc19b08ad204151e28634d4893996ed5750d2dccf18477e731

See more details on using hashes here.

File details

Details for the file dbsyncx-1.2.1-py3-none-any.whl.

File metadata

  • Download URL: dbsyncx-1.2.1-py3-none-any.whl
  • Upload date:
  • Size: 10.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.4

File hashes

Hashes for dbsyncx-1.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d9a8bae4f8c60931164c6ec6a75c8efeaf5751d8be1ff3bd44719c5a615d8229
MD5 a48af9a52f20b14141358adcb8e4ff64
BLAKE2b-256 99e24752de08fd6d059aea6a1b50dbdf15598874fc5b555b75f91f94eebba6af

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