Skip to main content

dbtalk

CI PyPI GitHub Release

dbtalk is an LLM-ready database CLI for SQL operations, JSONL data transfer, permissions, and logical backups across SQLite, MySQL, and PostgreSQL.

中文文档

Features

  • Run SQL with query and exec, including bound parameters and timeouts
  • Transfer JSONL data between SQLite, MySQL, and PostgreSQL
  • Manage MySQL schemas and users, and PostgreSQL schemas and roles
  • Grant and revoke permission profiles; inspect native permissions with permissions list/show
  • Create and restore MySQL SQL dumps and PostgreSQL custom archives
  • Provide database-focused skills for Codex, Claude, and Grok agents

Installation

Requires Python 3.12+. Install the published CLI with:

uv tool install pomelo-dbtalk
dbtalk --help

The package is published on PyPI. Each version is also available from GitHub Releases as a wheel and standalone binaries for Linux x86_64, macOS (Apple Silicon and Intel), and Windows x86_64.

To use a standalone binary, download the matching asset from a release, make it executable on Linux or macOS, then run it directly:

chmod +x dbtalk-linux-x86_64
./dbtalk-linux-x86_64 --help

From a checkout, use uv:

uv sync --all-groups
uv run dbtalk --help

Quick start

Keep the connection string in the current directory's .env, then refer to it only by name:

DBTALK_DSN_APP=sqlite:///./data/app.db
uv run dbtalk query \
  --dsn-env DBTALK_DSN_APP \
  --sql 'SELECT 1 AS ok'

uv run dbtalk exec \
  --dsn-env DBTALK_DSN_APP \
  --sql 'CREATE TABLE IF NOT EXISTS notes (id INTEGER PRIMARY KEY, body TEXT NOT NULL)'

uv run dbtalk exec \
  --dsn-env DBTALK_DSN_APP \
  --file ./data/notes.sql

uv run dbtalk exec \
  --dsn-env DBTALK_DSN_APP \
  --file ./data/notes.sql \
  --dry-run

query is read-only; exec runs a write-capable session. Add -v on a leaf command to see sanitized exception details.

Agents write the DSN to .env before the first database command. --dsn-env DBTALK_DSN_* reads the process environment first and only falls back to the current .env when that variable is absent.

Commands

Command Purpose
dbtalk mysql schema Manage MySQL schemas/databases
dbtalk mysql user Manage MySQL users
dbtalk mysql grant / dbtalk mysql revoke Grant or revoke MySQL permissions
dbtalk postgres schema Manage PostgreSQL schemas/databases
dbtalk postgres role Manage PostgreSQL roles
dbtalk postgres grant / dbtalk postgres revoke Grant or revoke PostgreSQL permissions
dbtalk postgres owner reassign Preview or transfer PostgreSQL role-owned objects
dbtalk mysql permissions list/show Inspect native MySQL permissions
dbtalk postgres permissions list/show Inspect native PostgreSQL permissions
dbtalk mysql dump/restore Create or restore MySQL SQL dumps
dbtalk postgres dump/restore Create or restore PostgreSQL custom archives
dbtalk query/exec Query or execute SQL; exec --file runs a UTF-8 SQL script
dbtalk export/import Transfer JSONL data

Run uv run dbtalk --help or a subcommand's --help for full options.

DSNs and configuration

Supported DSN examples:

sqlite:///./data/app.db
mysql+pymysql://user:password@host:3306/app
postgresql+psycopg://user:password@host:5432/app

Every command accepts exactly one of --dsn DSN or --dsn-env NAME; --dsn remains available for direct integrations. Agent workflows must plan a DBTALK_DSN_* name, write the value to the current .env, and use only --dsn-env. .env.local and other dotenv variants are not loaded. Defaults are in dbtalk.yaml and can be overridden with DBTALK_ process environment variables.

Documentation

Agent integration

The repository ships a dbtalk plugin for Codex, Claude, and Grok with three skills:

  • dbtalk: SQL and JSONL data transfer
  • dbtalk-mysql: MySQL schemas, users, permissions, and dump/restore
  • dbtalk-postgres: PostgreSQL schemas, roles, permissions, and dump/restore

Install or synchronize the local plugin with:

make install

See Agent plugin and skills for installation details, parameter constraints, and safety boundaries.

Development

make deps
make check
make test
make release

make check runs Ruff and Mypy. make test runs the test suite; integration tests requiring a real database are skipped by default.

License

Licensed under the Apache License, Version 2.0. See LICENSE.

Docker

docker build -t dbtalk .
docker run --rm dbtalk --help

Metadata

Release files for pomelo-dbtalk 0.35.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pomelo-dbtalk 0.35.0
File Size Uploaded
pomelo_dbtalk-0.35.0.tar.gz 68.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pomelo-dbtalk 0.35.0
File Interpreter ABI Platform
pomelo_dbtalk-0.35.0-py3-none-any.whl Python 3 none any Details

Total release size: 158.4 kB

Release files / pomelo_dbtalk-0.35.0.tar.gz

Download URL pomelo_dbtalk-0.35.0.tar.gz
Size 68.8 kB
Tags Source
SHA-256 checksum
How to use checksums
4c9f779158f7b8410f6a40db7534e40da460909a35ec0c59aba8334484a165ef
BLAKE2b-256 checksum
How to use checksums
69a02448125bfefe9c395afa80b3f2c0730b127f4cb67fdf7ddd31b195bb82f2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.3

Release files / pomelo_dbtalk-0.35.0-py3-none-any.whl

Download URL pomelo_dbtalk-0.35.0-py3-none-any.whl
Size 89.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e819c2ed8d623b61772619091dd54bc88577446ad333d8c26c5bf335c6421a92
BLAKE2b-256 checksum
How to use checksums
c087c104b8035b41a46322a03994f37b706102f06a55475970167b90d187c9fa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.3

Release history Release notifications | RSS feed

This release

0.35.0 This release

2 release files

0.30.5

2 release files

0.30.1

2 release files

0.28.0

2 release 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