Skippr is now Manifold.

Skip to content

mfd query ​

mfd query runs SQL against the data your pipelines have ingested. Each namespace is a table named <pipeline>.<namespace>, for example bikehire.rides. You query Manifold 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 (ManifoldLake, 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 Mfd's management statements (ENABLE PIPELINE, SCHEMA DUMP, ALTER TABLE, and others). Without --sql it opens an interactive prompt. How SELECT, STREAM, and Manifold Store pins fit together: Stream SQL.

Usage ​

python
import mfd

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

query reads every pipeline in mfd.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>./mfd.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
mfd query --plain --sql "SELECT count(*) AS rides FROM bikehire.rides"
json
{"header":["rides"],"rows":[["48213"]]}

Parse it with jq:

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

Explore interactively ​

bash
mfd 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
mfd query --sql "SELECT count(*) FROM bikehire.rides" --watch 5

Stream query ​

STREAM is the same Manifold 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
mfd query --sql "STREAM * FROM bikehire.rides LIMIT 100"

SELECT is a snapshot of Iceberg plus the WAL slices Manifold 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 Manifold Store snapshot and does not take writer.lock. See Stream SQL and Manifold Store.

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

Inspect a pipeline ​

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

Pause, resume, and reset a pipeline ​

bash
mfd query --sql "DISABLE PIPELINE bikehire"
mfd query --sql "ENABLE PIPELINE bikehire"
mfd query --sql "RESET PIPELINE bikehire"
mfd 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
mfd query --sql "SCHEMA DUMP bikehire TO 'bikehire-schema.json'"
mfd query --sql "LOAD SCHEMA 'bikehire-schema.json' INTO bikehire"
mfd query --sql "ALTER TABLE bikehire.rides DROP COLUMN legacy_field"
mfd query --sql "ALTER TABLE bikehire.rides ALTER COLUMN n TYPE BIGINT"
mfd query --sql "ALTER TABLE bikehire.rides RENAME COLUMN region TO region_code"
mfd query --sql "ALTER TABLE bikehire.rides MERGE COLUMN price_cents INTO price"
mfd 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 mfd migrate for file-backed batches. See ALTER operations for rename, merge, drop, type promote, and what fails closed.

Run mfd sql-help for the syntax of every statement, or mfd 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 mfd metadata show --pipeline <name> to list namespaces.
Pipeline '<name>' not foundThe pipeline in a management statement has no saved schema yet.Run mfd 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 ​