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)'

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 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 one SQL statement
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.28.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.28.0
File Size Uploaded
pomelo_dbtalk-0.28.0.tar.gz 62.5 kB Details

Built distribution (wheel)

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

Total release size: 144.8 kB

Release files / pomelo_dbtalk-0.28.0.tar.gz

Download URL pomelo_dbtalk-0.28.0.tar.gz
Size 62.5 kB
Tags Source
SHA-256 checksum
How to use checksums
d66b5954ac4ad0a245b42b5c9a6c59b645b88dde6aaf9b281517471c07c36ce6
BLAKE2b-256 checksum
How to use checksums
cefd37e26e8e2765b4e3691bb6e31032262fc9862c9c995be6bebd9c0fc5e39b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.2

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

Download URL pomelo_dbtalk-0.28.0-py3-none-any.whl
Size 82.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6d56ad0808a1798b6e1d3aff7696037b88e9993709e8f0cbb1be3706ba903757
BLAKE2b-256 checksum
How to use checksums
2924b8aa8eca5095fcd951d2f29477a6cc8ff4310be46ab2a00d9b7a55bef0c6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.2

Release history Release notifications | RSS feed

0.30.5

2 release files

0.30.1

2 release files

This release

0.28.0 This release

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