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.1.tar.gz (73.3 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.1-py3-none-any.whl (82.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sqlexplore-0.8.1.tar.gz
  • Upload date:
  • Size: 73.3 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.1.tar.gz
Algorithm Hash digest
SHA256 15f99babdc215fb1ee05229a54bcbd7dd53e49093b0e48d7407af5571744bec5
MD5 9e3f5664a28e144c1568b346624025fd
BLAKE2b-256 5a19a2554d34d22cf8cac5f0d304f561ec74dba2727a2cb43b32c07825fb2e53

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sqlexplore-0.8.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 109618f2e324793b9c00f095925b02bd4a173f5ddfbcae19ae305bdf7f7577ff
MD5 b294bd7628f5f57c8c86c97342c9a9bf
BLAKE2b-256 11082634441137a2b9e3cdeef5fc89ff6d6f964fe70aa0bf8bcc04908b2d8af4

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