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 my_data.parquet

Equivalent explicit form:

uvx --from sqlexplore sqlexplore --data my_data.parquet

Run one query and exit:

uvx sqlexplore --data https://github.com/dylanhogg/awesome-python/raw/refs/heads/main/github_data.parquet --execute "SELECT COUNT(*) AS n FROM data" --no-ui

Run SQL from file and exit:

uvx sqlexplore --data https://github.com/dylanhogg/awesome-python/raw/refs/heads/main/github_data.parquet --file ./queries/report.sql --no-ui

Use multiple inputs:

uvx sqlexplore --data ./data/january.parquet --data ./data/february.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 https://github.com/dylanhogg/awesome-python/raw/refs/heads/main/github_data.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.2.tar.gz (73.5 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.2-py3-none-any.whl (82.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sqlexplore-0.8.2.tar.gz
  • Upload date:
  • Size: 73.5 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.2.tar.gz
Algorithm Hash digest
SHA256 01b500bb4c64a382723f078d6e004a822c4d5968b23c8bda21a42c69ccfd3f98
MD5 74091def15450d9e4039bf13c839e175
BLAKE2b-256 e55f3221f6b3acec512ee6203a44bb94c88cb7cf37a3a0ad678ec45524417522

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sqlexplore-0.8.2-py3-none-any.whl
  • Upload date:
  • Size: 82.1 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 43e5626d54c536db0eb9eff21e122a0c7ffd4599c50e4e9b8d75946d60649bca
MD5 0975e401a3b81f43a877442b4004d955
BLAKE2b-256 a1fb8406ad01646f9af9a0dc501fe52ac18bf87d658a44521065136bfc6fb73d

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