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.25.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.25.1
File Size Uploaded
pomelo_dbtalk-0.25.1.tar.gz 61.6 kB Details

Built distribution (wheel)

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

Total release size: 142.9 kB

Release files / pomelo_dbtalk-0.25.1.tar.gz

Download URL pomelo_dbtalk-0.25.1.tar.gz
Size 61.6 kB
Tags Source
SHA-256 checksum
How to use checksums
827da2678538f5b9e5e233d1c78540e06e129138d0b23fe64cba3a6ddf2ae318
BLAKE2b-256 checksum
How to use checksums
fe1a01bfcc87904c3e4791792885693e6c3c5be1149486e230a1fd88e3601b30
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.25.1-py3-none-any.whl

Download URL pomelo_dbtalk-0.25.1-py3-none-any.whl
Size 81.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2ff37f70f91d50140128dca0e61127e0e0b147af6b6c8e2a662653b8e2f92e19
BLAKE2b-256 checksum
How to use checksums
2e55ec95fba7d78e482bb55aa8a41a5935909603a2b31a670e3c22a6d0a5c8eb
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.25.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