Skip to main content
DQL (DataView Query Language) lets you query frontmatter metadata across your entire knowledge base. It is inspired by Obsidian Dataview but runs server-side against the SQLite metadata index.

Query modes

DQL supports four output modes.
TABLE title, status, priority FROM "concepts" WHERE status = "draft" SORT priority DESC
  • TABLE returns tabular results with the fields you specify.
  • LIST returns a flat list of matching page paths.
  • COUNT returns the number of matching pages.
  • DISTINCT returns unique values for a single field.

Clauses

ClauseDescription
FROM "path/"Scope the query to a directory.
WHEREFilter with boolean logic (AND, OR, NOT), comparison operators (=, !=, >, <, >=, <=), CONTAINS, and MATCHES (regex).
SORT field ASC|DESCSort results by a field.
GROUP BY fieldGroup results by a field.
FLATTEN fieldExpand array fields into multiple rows.
LIMIT nCap the number of results.

Implicit fields

Every page exposes these fields without any frontmatter:
FieldDescription
_pathFile path relative to the knowledge base root.
_updatedLast modified timestamp.
_sizeFile size in bytes.
_wordsWord count of the page body.
TABLE _path, _words FROM "concepts" WHERE _words > 1000 SORT _words DESC

Expressions

DQL supports arithmetic, function calls, string interpolation, comparisons, and boolean logic inside WHERE and computed field definitions.
TABLE title, $.priority * 10 + len($.tags) AS score FROM "concepts" SORT score DESC

Built-in functions

DQL ships with 27 functions:
now(), date(), duration(), days_since(), format()
lower(), upper(), trim(), split(), join(), contains(), regextest()
round(), floor(), ceil(), abs(), min(), max()
len(), sum(), avg(), first(), last(), sort(), reverse(), unique()
meta() — access implicit fields programmatically.

CLI usage

Run a DQL query from the command line:
kiwifs query "TABLE title, status FROM 'concepts' WHERE status = 'draft'"

REST API

Run a DQL query over HTTP:
GET /api/kiwi/query?q=TABLE title, status FROM "concepts" WHERE status = "draft"

Aggregation

Use the aggregate command to group and summarize metadata:
kiwifs aggregate --group status --calc count,avg:priority
Supported aggregation functions: count, avg, sum, min, max. You can group by any frontmatter field.

Computed views

A markdown file with kiwi-view: true in its frontmatter becomes a computed view. KiwiFS auto-refreshes the file body from a DQL query embedded in the frontmatter.
---
kiwi-view: true
query: "TABLE title, status FROM 'concepts' WHERE status = 'draft' SORT _updated DESC"
---
The body of this file is overwritten with live query results on every index update. Think of it as a saved query that always shows current data.

Computed frontmatter fields

You can define virtual fields in .kiwi/config.toml that are evaluated at index time. These fields are queryable like any other frontmatter field.
[dataview]
computed_fields.age_days = "days_since(updated)"
computed_fields.is_long = "len(body) > 5000"
computed_fields.priority_score = "priority * 10 + len(tags)"
Computed fields are recalculated on every reindex. They do not modify your source files.
Last modified on May 4, 2026