Home

stencila query

Query a workspace database

Usage

stencila query [OPTIONS] <FILE> <QUERY> [OUTPUT]

Examples

# Query a specific document
stencila query article.qmd "paragraphs().sample(3)"

# Query with output to file
stencila query report.myst "headings(.level == 1)" headings.md

# Use Cypher query language
stencila query doc.ipynb --cypher "MATCH (h:Heading) WHERE h.level = 1 RETURN h"

Arguments

NameDescription
<FILE>The document to query.
<QUERY>The DocsQL or Cypher query to run.
[OUTPUT]The path of the file to output the result to.

Options

NameDescription
-c, --cypherUse Cypher as the query language (instead of DocsQL the default). Possible values: true, false.
--no-compileDo not compile the document before querying it. Possible values: true, false.
-t, --toThe format to output the result as.
--compactUse compact form of encoding if possible. Possible values: true, false.
-p, --prettyUse a "pretty" form of encoding if possible. Possible values: true, false.
© 2026 Stencila