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.1.tar.gz
(41.8 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
db_to_db-0.2.1-py3-none-any.whl
(38.1 kB
view details)
File details
Details for the file db_to_db-0.2.1.tar.gz.
File metadata
- Download URL: db_to_db-0.2.1.tar.gz
- Upload date:
- Size: 41.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c6d6afa8a2575ed6d4f6ce1cc42a548f445464498ee9980ba7c03edeb9d179ad
|
|
| MD5 |
90a2496bf9f6247589bf383f069753c0
|
|
| BLAKE2b-256 |
50a04c982e9e5e4b150356ccab857cf06ebde2c49150a24bf5ec5110cac09df6
|
File details
Details for the file db_to_db-0.2.1-py3-none-any.whl.
File metadata
- Download URL: db_to_db-0.2.1-py3-none-any.whl
- Upload date:
- Size: 38.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f794aec9bc2427ecc2b376db44d5a86c07d98d24c9e4250ca4eb62aac0d306e4
|
|
| MD5 |
116d5edb2a64a2c9df7b9bfdcae5cc83
|
|
| BLAKE2b-256 |
08b9bfefcf0e17becc0a6a7a6810aaa588975918a037815d05fd46a57a5a51b8
|