seeknal query¶
Query metrics from the semantic layer. Compiles metric definitions into SQL, executes against DuckDB, and returns formatted results.
Synopsis¶
Description¶
The query command allows you to query business metrics defined in your
semantic layer. It compiles metric definitions (from seeknal/metrics/) into
SQL and executes them against cached data.
Metrics can include: - Simple aggregations (sum, count, avg) - Time-based calculations - Multi-dimensional analysis
Options¶
| Option | Description |
|---|---|
--metrics |
Comma-separated metric names (required) |
--dimensions |
Comma-separated dimensions (e.g., region,ordered_at__month) |
--filter |
SQL filter expression |
--order-by |
Order by columns (prefix - for DESC) |
--limit |
Maximum rows to return (default: 100) |
--compile |
Show generated SQL without executing |
--format |
Output format: table, json, csv (default: table) |
--project-path |
Project directory (default: current directory) |
Examples¶
Query a single metric¶
Query multiple metrics with dimensions¶
Query with time dimension¶
Query with filter¶
Query with ordering¶
Show generated SQL¶
Output as JSON¶
Defining Metrics¶
Metrics are defined in YAML files under seeknal/metrics/:
kind: metric
name: total_revenue
description: Total revenue from all orders
type: sum
measure: sales.price
model: sales_model
See Also¶
- seeknal repl - Start interactive SQL REPL
- seeknal audit - Run data quality audits