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.0

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.0 (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.0.tar.gz (13.0 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.0-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: dbsyncx-1.2.0.tar.gz
  • Upload date:
  • Size: 13.0 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.0.tar.gz
Algorithm Hash digest
SHA256 86cf1fd877f644c95edfa629922726f2ce3656d00825ad6242b37a3203d6ef8a
MD5 b84830be46210f8c99dfc0ea50aa0e90
BLAKE2b-256 b137bcc35a95469a6c1138a1538f181e012105194eba8c52a64fe279b61b3c2f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dbsyncx-1.2.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7a63481c47fe0793275be0625141dbc05894a08ede299ab7b1decb131c3ec6d3
MD5 86ae5b6c596de3701e9dceb3eea9c6c8
BLAKE2b-256 f32edfa84388c9cd0fbd43981fa023c7a0795c25882f3c53101f1b2d0934f4e7

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