Skip to main content

dbtalk

CI

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

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

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.23.1
File Size Uploaded
pomelo_dbtalk-0.23.1.tar.gz 61.1 kB Details

Built distribution (wheel)

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

Total release size: 141.4 kB

Release files / pomelo_dbtalk-0.23.1.tar.gz

Download URL pomelo_dbtalk-0.23.1.tar.gz
Size 61.1 kB
Tags Source
SHA-256 checksum
How to use checksums
744cd6f635281a4b27b5149a69696b9283cdf16fc6649138d0765fd2e551caed
BLAKE2b-256 checksum
How to use checksums
99adc3e0fa6c5e239ce8fa4283178e1a9ecb4cb782362fc6c230f06d7f64a479
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.23.1-py3-none-any.whl

Download URL pomelo_dbtalk-0.23.1-py3-none-any.whl
Size 80.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e1f7400c5326cefc8ee7609bc0d83a35744056ac15d785324a83e4216f22d093
BLAKE2b-256 checksum
How to use checksums
ca94c8494625f134fe3898bfd53d735383ac82a83a1edba030c58c2efe5d88a4
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

0.30.5

2 release files

0.30.1

2 release files

0.28.0

2 release files

This release

0.23.1 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