Skip to main content

SQL exploration over data files with your CLI and LLM

Project description

sqlexplore

License: MIT PyPI version build Latest Tag Downloads

sqlexplore is a terminal SQL explorer for flat files (.csv, .tsv, .txt, .parquet, .pq), powered by DuckDB.

Use it when you need quick answers from local files, URLs, or piped terminal output without building a separate pipeline first.

Useful features

  • Interactive TUI with query editor, results grid, cell preview, and activity log.
  • Non-interactive mode (--no-ui) for one-shot queries in plain terminal output.
  • SQL helper commands for common analysis and shaping tasks: /summary, /describe, /profile, /hist, /corr, /top, /dupes, /crosstab, /sample, /filter, /sort, /group, /agg.
  • LLM-assisted SQL generation with /llm-query, plus trace tools (/llm-history, /llm-show).
  • Query history and rerun helpers (/history, /rerun, /history-log, /rerun-log).
  • Context-aware autocomplete for SQL and helper commands.
  • Result export via /save to .csv, .parquet/.pq, or .json.
  • JSON-aware table rendering and preview, including compact image-cell tokens for image-like values.
  • Local files, HTTP(S) URLs, and stdin input (for piped text).
  • Multiple sources via repeated --data (schemas must match; sources are unioned).
  • Remote download cache controls with --download-dir and --overwrite.
  • .txt input support with derived fields like line_number, line_length, word_count, and line_hash.

Run with uvx (preferred)

Requires Python 3.13+.

Run directly without a manual install:

uvx sqlexplore --data ./data/example.parquet

Equivalent explicit form:

uvx --from sqlexplore sqlexplore --data ./data/example.parquet

Run one query and exit:

uvx sqlexplore --data ./data/example.parquet --execute "SELECT COUNT(*) AS n FROM data" --no-ui

Run SQL from file and exit:

uvx sqlexplore --data ./data/example.parquet --file ./queries/report.sql --no-ui

Use multiple inputs:

uvx sqlexplore --data ./data/jan.parquet --data ./data/feb.parquet

Analyze piped terminal text:

ls -lha | uvx sqlexplore

Open remote data (downloaded then loaded):

uvx sqlexplore --data https://github.com/dylanhogg/awesome-python/raw/refs/heads/main/github_data.parquet

Install with pip

pip install sqlexplore
sqlexplore --data ./data/example.parquet

LLM usage (optional)

Set an API key for your chosen LiteLLM provider (for example OPENAI_API_KEY), then run:

/llm-query top 10 customers by total revenue

Optional model override:

export SQLEXPLORE_LLM_MODEL=openai/gpt-5-mini

Notes

  • --data can be omitted when piping stdin.
  • If stdin has no controlling TTY, sqlexplore falls back to --no-ui.
  • --limit sets default helper query limit. /limit also updates row display limit.
  • Logs are written to sqlexplore.log in your app log directory (with fallbacks).
  • Run sqlexplore --help to view all options.

Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sqlexplore-0.8.0.tar.gz (70.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sqlexplore-0.8.0-py3-none-any.whl (78.8 kB view details)

Uploaded Python 3

File details

Details for the file sqlexplore-0.8.0.tar.gz.

File metadata

  • Download URL: sqlexplore-0.8.0.tar.gz
  • Upload date:
  • Size: 70.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.24 {"installer":{"name":"uv","version":"0.9.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for sqlexplore-0.8.0.tar.gz
Algorithm Hash digest
SHA256 be8f53b3e0b9e8eacc021fa604c93635850f45b75fe9b8e924653917f0415b10
MD5 d39500e99aa17806dd48bb9ff487b353
BLAKE2b-256 bc691a466cd7c72bfc36a8e4338e7f23a57da23eaf522e2a04049aa5a52873bb

See more details on using hashes here.

File details

Details for the file sqlexplore-0.8.0-py3-none-any.whl.

File metadata

  • Download URL: sqlexplore-0.8.0-py3-none-any.whl
  • Upload date:
  • Size: 78.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.24 {"installer":{"name":"uv","version":"0.9.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for sqlexplore-0.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2375499e5292f4b5b45729ea15b4149657d23b314adf49fae4b1028633985f60
MD5 47f82885f7553357e3bf84cc8d1100ae
BLAKE2b-256 d500b7f316f057a48333f6862a55bfd12e95c36287638388e876aefcc3bf617b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page