Skip to content

skipprd query ​

skipprd query runs SQL against the data your pipelines have ingested. Each namespace is a table named <pipeline>.<namespace>, for example bikehire.rides. You query Skippr once: live stream plus history together. You do not pick a live view or a history view. What a table contains depends on the destination:

  • No destination, or a non-Iceberg destination (Athena, Snowflake, Postgres, and others): the live data in the WAL. For the full history in a warehouse, query the warehouse itself.
  • Iceberg destination (SkipprLake, AthenaIceberg, DuckDB): the Iceberg table combined with live data still in the WAL, so you see rows the moment they are ingested.

Use query to check a sync, explore data, script checks in CI, tail new results with STREAM, and run Skipprd's management statements (ENABLE PIPELINE, SCHEMA DUMP, ALTER TABLE, and others). Without --sql it opens an interactive prompt. How SELECT, STREAM, and Skippr Store pins fit together: Stream SQL.

Usage ​

python
import skippr

session = skippr.Session(skippr.Config.discover().get_pipeline("bikehire"))
table = session.query("SELECT count(*) AS rides FROM bikehire.rides")
print(table.to_pylist())
bash
skipprd query --sql "<SQL>" [--plain] [--watch <seconds>] [--warmup] [--repeat <N>] [--config <path>] [--log [LEVEL]]
skipprd query                      # interactive prompt

query reads every pipeline in skippr.yml; there is no --pipeline flag. Name tables in full.

Options ​

FlagDefaultDescription
-s, --sql <SQL>NoneStatement to run. Without it, query opens an interactive sql> prompt; type :q, :quit, or exit to leave.
--plainOffPrint one JSON document to stdout instead of the interactive table view: {"header": [...], "rows": [[...]]}. All values are strings. Use this in scripts.
--watch <SECONDS>OffRe-run a SELECT every N seconds in the interactive table view. Ignored with --plain. Not STREAM.
--warmupOffOpen catalogs and run the statement once, then time the second collect.
--repeat <N>1Extra untimed collects after the measured one. For profiling.
--config <PATH>./skippr.ymlConfig file to read.
--log [LEVEL]OffPrint logs to stderr.
--wal-storage <MODE>diskWAL backend: disk or s3. Same as WAL_STORAGE.

See CLI overview for the other global flags.

In the interactive table view, press Enter to run the SQL and q to quit. Outside --plain, the elapsed time is printed to stderr as Query time: N seconds.

Examples ​

Count rows for a script ​

bash
skipprd query --plain --sql "SELECT count(*) AS rides FROM bikehire.rides"
json
{"header":["rides"],"rows":[["48213"]]}

Parse it with jq:

bash
skipprd query --plain --sql "SELECT count(*) AS rides FROM bikehire.rides" | jq -r '.rows[0][0]'

Explore interactively ​

bash
skipprd query --sql "SELECT station, count(*) AS rides FROM bikehire.rides GROUP BY station ORDER BY rides DESC LIMIT 10"

Watch a table fill during a sync ​

bash
skipprd query --sql "SELECT count(*) FROM bikehire.rides" --watch 5

Stream query ​

STREAM is the same Skippr SQL as SELECT on that table. It tails new results to stdout as they arrive, like watch. LIMIT stops the stream. --watch is a poll of SELECT, not STREAM.

bash
skipprd query --sql "STREAM * FROM bikehire.rides LIMIT 100"

SELECT is a snapshot of Iceberg plus the WAL slices Skippr Store pinned for that statement. STREAM follows new live rows on that same table. A second query process can run while sync holds the writer. It pins a flushed Skippr Store snapshot and does not take writer.lock. See Stream SQL and Skippr Store.

skipprd serve Flight SQL uses the same Iceberg ∪ WAL registration as skipprd query. If WAL is absent on that node it falls through to Iceberg history.

Inspect a pipeline ​

bash
skipprd query --sql "SHOW PIPELINE bikehire"
skipprd query --sql "SHOW STATS FOR bikehire.rides"

Pause, resume, and reset a pipeline ​

bash
skipprd query --sql "DISABLE PIPELINE bikehire"
skipprd query --sql "ENABLE PIPELINE bikehire"
skipprd query --sql "RESET PIPELINE bikehire"
skipprd query --sql "DROP PIPELINE bikehire"

RESET PIPELINE clears the pipeline's offsets and buffered WAL data immediately, so the next sync reads the source from the start. DROP PIPELINE removes all schemas and data for the pipeline immediately.

Manage schemas ​

bash
skipprd query --sql "SCHEMA DUMP bikehire TO 'bikehire-schema.json'"
skipprd query --sql "LOAD SCHEMA 'bikehire-schema.json' INTO bikehire"
skipprd query --sql "ALTER TABLE bikehire.rides DROP COLUMN legacy_field"
skipprd query --sql "ALTER TABLE bikehire.rides ALTER COLUMN n TYPE BIGINT"
skipprd query --sql "ALTER TABLE bikehire.rides RENAME COLUMN region TO region_code"
skipprd query --sql "ALTER TABLE bikehire.rides MERGE COLUMN price_cents INTO price"
skipprd query --sql "ALTER COMPUTE bikehire.station_totals ALTER COLUMN ride_count SET MEASURE COUNT(*)"

SQL must match the pipeline output names. Nested pipelines use dotted paths (detail.truck_reg). Flattened pipelines use underscores (detail_truck_reg). Do not mix the two forms.

ALTER TABLE applies in-stream; DISABLE PIPELINE is freeze-only. Prefer skipprd migrate for file-backed batches. See ALTER operations for rename, merge, drop, type promote, and what fails closed.

Run skipprd sql-help for the syntax of every statement, or skipprd query --sql "SHOW DOCS".

Troubleshooting ​

SymptomCauseFix
ERROR: Unqualified table name detectedA table in the query has no pipeline prefix.Qualify every table as <pipeline>.<namespace>, for example bikehire.rides. Journaled compute names use the same two-part form.
query failed: ... table ... not found with --plainThe table name is wrong, or the pipeline has not been discovered or synced yet.Run skipprd metadata show --pipeline <name> to list namespaces.
Pipeline '<name>' not foundThe pipeline in a management statement has no saved schema yet.Run skipprd discover --pipeline <name> first.
Fewer rows than in your warehouseNon-Iceberg destinations only expose data still in the WAL.Query the warehouse directly for full history.

In scripts, use --plain: a failing SELECT then prints query failed: <reason> to stderr and exits 1. Without --plain, some errors are printed but the command still exits 0.

Next steps ​