Skip to main content

No project description provided

Project description

spark-viewer-tui

A terminal UI for browsing and querying Delta Lake and Parquet tables with Apache Spark.

Built with Textual and PySpark.

GitHub: https://github.com/eritondev-stack/spark-viewer-tui

spark-viewer-tui

video demo

Features

  • Catalog Browser - Sidebar tree with databases and tables
  • SQL Editor - Write and execute Spark SQL queries with syntax highlighting
  • Results Table - View query results with column types and row count
  • Scan Paths - Auto-register Delta/Parquet folders as Spark tables
  • Rescan - Refresh tables on demand (folders are live, Ctrl+R rescans)
  • Save/Load Queries - Persist frequently used queries
  • Themes - Multiple color themes (Transparent, Dracula, Gruvbox)
  • Maximize - Focus on editor or results in full screen

Requirements

  • Python 3.9+
  • Java 17 (for PySpark) — must be available via JAVA_HOME or java in your PATH

Java Setup

macOS (Homebrew):

brew install openjdk@17
export JAVA_HOME=$(/usr/libexec/java_home -v 17)

Linux (Debian/Ubuntu):

sudo apt install openjdk-17-jdk
export JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64

Add the export JAVA_HOME=... line to your ~/.bashrc or ~/.zshrc to make it persistent.

Verify:

java -version

Installation

pip install spark-viewer-tui

Or with uv:

uv pip install spark-viewer-tui

Usage

spark-viewer

Or run directly from source:

uv run spark-viewer

Keyboard Shortcuts

Key Action
F2 Spark Configuration (metastore, warehouse, scan paths)
F3 Save current query
F4 Load saved query
Ctrl+R Start Spark session / Rescan paths
Ctrl+E Execute SQL query
Ctrl+T Change theme
Ctrl+W Maximize editor or results
Ctrl+C Exit

Getting Started

  1. Run spark-viewer
  2. Press F2 to configure:
    • Metastore DB Path - Where Spark stores metadata (e.g. /tmp/metastore_db)
    • Warehouse Dir Path - Spark warehouse directory (e.g. /tmp/spark-warehouse)
    • Scan Paths - Folders to scan for Delta/Parquet tables
  3. Press Ctrl+R to start the Spark session
  4. Click a table in the sidebar or write SQL in the editor
  5. Press Ctrl+E to run the query

Seed (Example Data)

The package includes a seed command that creates 6 Delta tables with 500 rows each (employees, products, orders, customers, logs, metrics). Useful for testing and exploring the tool.

# Uses paths from spark_config.json
spark-viewer-seed

# Or specify paths manually
spark-viewer-seed --metastore-db ./metastore_db --warehouse-dir ./spark-warehouse

After seeding, run spark-viewer and press Ctrl+R to load the tables.

Scan Paths

Scan paths auto-register Delta and Parquet tables from a directory. Each scan path has a database name and a folder path.

db_name: vendas
path:    /data/warehouse

Subfolders are registered as tables:

  • Subfolder with _delta_log/ -> Delta table
  • Subfolder with .parquet files -> Parquet table

Every Ctrl+R (Refresh Catalog) drops and recreates the databases from scan paths, keeping tables in sync with the filesystem.

Configuration

Settings are saved in spark_config.json in the project directory:

{
  "metastore_db": "/tmp/metastore_db",
  "warehouse_dir": "/tmp/spark-warehouse",
  "scan_paths": [
    { "path": "/data/warehouse", "db_name": "vendas" },
    { "path": "/data/lake", "db_name": "analytics" }
  ]
}

Themes are stored in ~/.config/spark-viewer-tui/themes.json. The file is created automatically on first run with the default themes. Edit it to customize colors or add new themes.

Project Structure

spark-viewer-tui/
├── src/
│   └── spark_viewer_tui/
│       ├── app.py              # Main application
│       ├── seed.py             # Seed example Delta tables
│       ├── config.py           # Configuration management
│       ├── spark_manager.py    # Spark session and table registration
│       ├── queries.py          # Query persistence
│       ├── themes.py           # Theme system
│       └── screens/
│           ├── spark_config.py    # Spark config modal (F2)
│           ├── save_query.py      # Save query modal (F3)
│           ├── load_query.py      # Load query modal (F4)
│           └── theme_selector.py  # Theme selector modal (Ctrl+T)
└── pyproject.toml

License

MIT

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

spark_viewer_tui-0.1.8.tar.gz (599.5 kB view details)

Uploaded Source

Built Distribution

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

spark_viewer_tui-0.1.8-py3-none-any.whl (21.0 kB view details)

Uploaded Python 3

File details

Details for the file spark_viewer_tui-0.1.8.tar.gz.

File metadata

  • Download URL: spark_viewer_tui-0.1.8.tar.gz
  • Upload date:
  • Size: 599.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for spark_viewer_tui-0.1.8.tar.gz
Algorithm Hash digest
SHA256 657ed972f4f5d304f301014055940b39dfa9a4a5ac64c432731f306ca02bbf3e
MD5 c8e03d8d897c8c337ae75d4480d20096
BLAKE2b-256 a9af7b20cbfcf479338a02d7f1d0250ddc178dcee0415c56867a46f834cac27a

See more details on using hashes here.

Provenance

The following attestation bundles were made for spark_viewer_tui-0.1.8.tar.gz:

Publisher: publish.yml on eritondev-stack/spark-viewer-tui

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file spark_viewer_tui-0.1.8-py3-none-any.whl.

File metadata

File hashes

Hashes for spark_viewer_tui-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 cab1f32fba4ba42a634c520246866cdd2cdb8a0cdb9a517fe5da005d25749225
MD5 7ba150e2afc280681c2899d10347269a
BLAKE2b-256 a33ccab757f20eb9f5d67fa6efa079af9840646609a68b3585cfadc2362885ef

See more details on using hashes here.

Provenance

The following attestation bundles were made for spark_viewer_tui-0.1.8-py3-none-any.whl:

Publisher: publish.yml on eritondev-stack/spark-viewer-tui

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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