Skip to main content

db-to-db

PostgreSQL 表同步工具 — 浏览器操作,纯 Python,一条命令即可部署为 Windows 系统服务。


快速开始

pip install db-to-db

# 方式 A:手动启动(调试用)
db-to-db run --open

# 方式 B:安装为系统服务(开机自启,无终端窗口)
db-to-db service install --port 5001

浏览器打开 http://127.0.0.1:5001


功能

功能 说明
连接管理 保存多个数据库连接,支持直连 / HTTP 代理
表同步 选择源和目标库,勾选表,一键 TRUNCATE + INSERT
同步历史 查看过往同步记录,含状态、行数、错误信息
热重载 修改代码无需重启服务,uvicorn --reload 自动检测
开机自启 通过 WinSW 注册为 Windows 系统服务

CLI 命令

# 启动
db-to-db run                        # 启动 Web 界面
db-to-db run --open                 # 启动并打开浏览器

# 服务管理(Windows)
db-to-db service install            # 安装服务(开机自启)
db-to-db service uninstall          # 卸载
db-to-db service start|stop|restart # 服务控制
db-to-db service status             # 查看状态
db-to-db service info               # 运维指南

# 版本
db-to-db version

自定义代码 + 热重载

git clone <仓库地址>
cd db-to-db
pip install -e .        # 可编辑安装

修改源码 → 保存即生效,uvicorn 自动热重启。


技术栈

  • FastHTML — AI 时代的 Python Web 框架
  • HTMX — 零手写 JS 的交互
  • DuckDB — 嵌入式本地配置存储
  • psycopg2 — PostgreSQL 连接驱动
  • uvicorn — Python ASGI 服务器(--reload 热重载)
  • WinSW — Windows 服务封装
  • Click — CLI 命令行框架
  • httpx — HTTP 客户端(代理模式)

数据存储

默认位置:~/.db-to-db/config.duckdb 环境变量 DB_TO_DB_DIR 可自定义。


许可证

MIT © tieshou(望月)

Download files

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

Source Distribution

db_to_db-0.2.0.tar.gz (33.0 kB view details)

Uploaded Source

Built Distribution

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

db_to_db-0.2.0-py3-none-any.whl (33.5 kB view details)

Uploaded Python 3

File details

Details for the file db_to_db-0.2.0.tar.gz.

File metadata

  • Download URL: db_to_db-0.2.0.tar.gz
  • Upload date:
  • Size: 33.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for db_to_db-0.2.0.tar.gz
Algorithm Hash digest
SHA256 53db6bd17c389fd22a8f236bdbe20e7e6549d8da77d90f739cd00a954e5cb362
MD5 48c240d39c0b8c85baa6648f0567b379
BLAKE2b-256 0443f7a3f8cc33155262e970c1148d150bf8ffe1f60a78d48bed6778d5ecc4a7

See more details on using hashes here.

File details

Details for the file db_to_db-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: db_to_db-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 33.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for db_to_db-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 37636cffac7ab610195ac52078838a7765532fb42d67e9b413d1d6df9fa33492
MD5 ab47bca534a6f7561f87fc841700a674
BLAKE2b-256 869c2d2d8cde101474d580a4b7c4fd7818d1e1bef4c4083cb80e04383264d915

See more details on using hashes here.

Release history Release notifications | RSS feed

0.2.1

2 files

This release

0.2.0 This release

2 files

0.1.0

2 files

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