stmo-cli
Rust CLI for version controlling Redash queries and dashboards.
Features
- Version control Redash queries (SQL + metadata) and dashboards
- Automatic query discovery from local files
- Automatic deployment to Redash
- Built in Rust for blazing fast performance
- Pedantic code quality with clippy pre-commit hooks
Prerequisites
- Rust 1.89+ with 2024 edition support
- Redash API key from https://sql.telemetry.mozilla.org
Claude Integration
stmo-cli works great with the mozdata-claude-plugin, which provides Mozilla telemetry expertise and discovery directly in Claude.
Installation
# The binary will be at ./target/release/stmo-cli
Setup
-
Get your Redash API key from your user profile
-
Set environment variables:
# optional, this is the default
- Create directories:
- Discover available queries:
- Fetch specific queries:
Usage
Fetch Queries from Redash
This creates/updates:
queries/{id}-{slug}.sql- Query SQLqueries/{id}-{slug}.yaml- Query metadata (parameters, visualizations, etc.)
Deploy to Redash
Warning: This force overwrites the queries in Redash. Git is the source of truth.
File Structure
queries/
├── 123-mobile-crashes.sql
└── 123-mobile-crashes.yaml
dashboards/
└── 456-my-dashboard.yaml
Query IDs are embedded in filenames ({id}-{slug}.{ext}), so no separate config file is needed.
Development
Pre-commit Hooks
The project uses clippy in pedantic mode:
Install pre-commit hooks:
Building for Release
Architecture
See CLAUDE.md for detailed architecture documentation.