Skip to main content

Rosetta

Cross-DBMS SQL testing & benchmarking toolkit.

Rosetta executes SQL against multiple databases (TDSQL, MySQL, TiDB, OceanBase, etc.), compares behavioral consistency via MTR-style .test files, benchmarks query performance, and provides an interactive SQL playground — all with visual reports.

Requirements

  • Python >= 3.8
  • PyMySQL >= 1.0
  • Rich >= 13.0
  • prompt_toolkit >= 3.0.52

Installation

curl -fsSL https://raw.githubusercontent.com/sjyango/rosetta/main/install.sh | bash

This script will:

  • Clone the repository to ~/.rosetta
  • Create a Python virtual environment
  • Install all dependencies
  • Add rosetta to your PATH

Options:

# Install to custom directory
curl -fsSL https://raw.githubusercontent.com/sjyango/rosetta/main/install.sh | bash -s -- -d /opt/rosetta

# Install specific branch
curl -fsSL https://raw.githubusercontent.com/sjyango/rosetta/main/install.sh | bash -s -- -b release-1.0.0

Manual Install

git clone https://github.com/sjyango/rosetta.git
cd rosetta
pip install -e .

Single File (.pyz)

./build.sh  # Output: dist/rosetta.pyz
pip install pymysql "rich>=13.0" "prompt_toolkit>=3.0.52"
python3 rosetta.pyz --help

Uninstall

curl -fsSL https://raw.githubusercontent.com/sjyango/rosetta/main/uninstall.sh | bash

Quick Start

# 1. Generate config file
rosetta config init

# 2. Edit DB connection info
vim rosetta_config.json

# 3. Check DB connectivity
rosetta status

# 4. Execute SQL across databases
rosetta exec --dbms tdsql,mysql --sql "SELECT VERSION()"

# 5. Run MTR consistency test
rosetta mtr --dbms tdsql,mysql -t test.test

# 6. Run performance benchmark
rosetta bench --dbms tdsql,mysql --file bench.json

# 7. Browse historical results
rosetta result list

# 8. Interactive mode (REPL)
rosetta i

Usage

rosetta <command> [options]

Global Options

All commands support these flags (can appear before or after the subcommand):

Argument Default Description
-j / --json False JSON output (AI Agent friendly)
-c / --config rosetta_config.json DBMS config file path
-v / --verbose False Enable verbose/debug logging

Commands


status — Check DB Connection Status

Check connectivity and version for all enabled databases in config.

rosetta status
rosetta status -j
rosetta status --timeout 10
Argument Default Description
--timeout 5 Connection timeout in seconds

exec — Execute SQL (Playground)

Execute SQL statements across databases and compare results side-by-side.

# Execute single SQL
rosetta exec --dbms tdsql,mysql --sql "SELECT VERSION()"

# Execute SQL from file
rosetta exec --dbms tdsql,mysql --file queries.sql

# Execute on a specific database
rosetta exec --dbms mysql -d mydb --sql "SHOW TABLES"
Argument Required Default Description
--sql one of --sql / --file — SQL statement to execute
--file one of --sql / --file — File containing SQL statements
--dbms ❌ all enabled DBMS targets (comma-separated)
-d / --database ❌ none Database name (omit to connect without USE)

mtr — MTR Consistency Test

Execute .test files and compare SQL execution results across databases. Generates HTML diff reports.

# Basic MTR test
rosetta mtr --dbms tdsql,mysql -t test.test

# With baseline comparison
rosetta mtr --dbms tdsql,mysql --baseline tdsql -t test.test

# Parse only (no execution)
rosetta mtr --dbms tdsql,mysql --parse-only -t test.test

# Serve HTML report after test
rosetta mtr --dbms tdsql,mysql --serve -t test.test
Argument Required Default Description
-t / --test ✅ — Path to .test file
--dbms ✅ — DBMS targets (comma-separated)
-b / --baseline ❌ tdsql Baseline DBMS for diff comparison
-d / --database ❌ rosetta_mtr_test Test database name
-o / --output-dir ❌ results Report output directory
-f / --output-format ❌ all Report format: text, html, all
--parse-only ❌ False Only parse .test file, no execution
--diff-only ❌ False Re-generate reports from existing .result files
-s / --serve ❌ False Start HTTP server to view reports
-p / --port ❌ 19527 HTTP server port

bench — Performance Benchmark

Compare query performance across databases with custom workloads. Supports serial and concurrent modes.

# Serial benchmark
rosetta bench --dbms tdsql,mysql --mode SERIAL --iterations 10 --file bench.json

# Concurrent benchmark (8 threads, 60s)
rosetta bench --dbms tdsql,mysql \
  --mode CONCURRENT --concurrency 8 --duration 60 --file bench.json

# Skip setup (reuse tables from previous run)
rosetta bench --dbms tdsql,mysql --skip-setup --file bench.json

# Disable flame graph capture
rosetta bench --dbms tdsql,mysql --no-profile --file bench.json
Argument Required Default Description
--dbms ✅ — DBMS targets (comma-separated)
--file ✅ — Benchmark definition file (.json / .sql)
--mode ❌ SERIAL Execution mode: SERIAL or CONCURRENT
-d / --database ❌ rosetta_bench_test Benchmark database name
-o / --output-dir ❌ results Report output directory
-f / --output-format ❌ all Report format: text, html, all

Serial mode (--mode SERIAL):

Argument Default Description
--iterations 1 Iterations per query
--warmup 0 Warmup iterations

Concurrent mode (--mode CONCURRENT):

Argument Default Description
--concurrency 10 Number of concurrent threads
--duration 30 Duration in seconds
--warmup 0 Warmup duration in seconds
--ramp-up 0 Ramp-up seconds for threads

Common options:

Argument Default Description
--query-timeout 5 Query timeout in seconds (0 = disabled)
--bench-filter — Run only queries matching these names (comma-separated)
--repeat 1 Number of benchmark rounds
--skip-setup False Skip setup phase (reuse existing tables)
--skip-teardown False Skip teardown (keep tables for next run)
--no-parallel-dbms False Run DBMS targets sequentially
--no-profile False Disable flame-graph capture
--perf-freq 99 perf sampling frequency in Hz

config — Manage Configuration

View, validate, or generate DBMS configuration files.

# Generate sample config
rosetta config init

# Generate to custom path
rosetta config init --output my_config.json

# Show current config
rosetta config show

# Validate config (check JSON + connectivity)
rosetta config validate
Action Description
init Generate a sample config.sample.json
show Display current config details
validate Validate JSON structure and test connectivity

result — Browse Historical Results

List, inspect, and navigate past MTR and benchmark runs.

# List runs (default: 20 per page)
rosetta result list

# Pagination
rosetta result list -n 10 -p 2

# Filter by type
rosetta result list --type bench
rosetta result list --type mtr

# Show details of latest run
rosetta result show

# Show a specific run (prefix match supported)
rosetta result show bench_json_mv_select_20260331

# JSON output
rosetta result show -j

result list options:

Argument Default Description
-n / --limit 20 Rows per page
-p / --page 1 Page number
--type all Filter: all, mtr, bench
-o / --output-dir results Results directory

result show options:

Argument Default Description
run_id latest Run ID or prefix (optional)
-o / --output-dir results Results directory

i / repl / interactive — Interactive REPL

Launch an interactive session for ad-hoc SQL execution, MTR tests, and benchmarks.

rosetta i
rosetta i --dbms tdsql,mysql
rosetta i --serve
Argument Default Description
--dbms all enabled DBMS targets (comma-separated)
-d / --database cross_dbms_test_db Test database name
-o / --output-dir results Report output directory
-s / --serve False Start HTTP server for reports
-p / --port 19527 HTTP server port

Configuration

Sample rosetta_config.json:

{
  "databases": [
    {
      "name": "tdsql",
      "host": "127.0.0.1",
      "port": 3306,
      "user": "root",
      "password": "",
      "driver": "pymysql",
      "enabled": true
    }
  ]
}

Output Files

File Description
<test_name>.html Interactive HTML report with side-by-side diff
<test_name>.report.txt Text summary report
bench_result.json Benchmark raw data (JSON)
index.html History page of all test runs
whitelist.json Persisted whitelist for acceptable diffs
buglist.json Tracked known bugs from diff results

Testing

python -m pytest tests/test_cli.py -v

Getting Help

rosetta --help
rosetta <command> --help

Metadata

Release files for rosetta-sql 1.5.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 rosetta-sql 1.5.1
File Size Uploaded Provenance Actions
rosetta_sql-1.5.1.tar.gz 253.0 kB With provenance Details for rosetta_sql-1.5.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for rosetta-sql 1.5.1
File Interpreter ABI Platform Actions
rosetta_sql-1.5.1-py3-none-any.whl Python 3 none any Details for rosetta_sql-1.5.1-py3-none-any.whl

Total release size: 526.6 kB

Release files / rosetta_sql-1.5.1.tar.gz

Download URL rosetta_sql-1.5.1.tar.gz
Size 253.0 kB
Tags Source
SHA-256 checksum
How to use checksums
52460ac47efbd504355d8ca10744c16d12f84bc82edeedc5cf9e80d3f2a14b17
BLAKE2b-256 checksum
How to use checksums
92ce1b770b17c93442f916faa69902425cbbb8d44f8c60a8763d71695042b9d6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 1, 2026.

Transparency log

Release files / rosetta_sql-1.5.1-py3-none-any.whl

Download URL rosetta_sql-1.5.1-py3-none-any.whl
Size 273.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
85cae842e7b150455d0c314568244d587c04d2dda1a121733b63bbea0b64cffa
BLAKE2b-256 checksum
How to use checksums
e6dea3faa791fc4e6f15c3d15537187b87344c3a46328a395b37f128bc49c3e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 1, 2026.

Transparency log

Security for rosetta-sql 1.5.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for rosetta_sql-1.5.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 1, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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