Skip to main content

DQL Syntax Reference

Complete formal syntax and clause reference for Basalt's Dataview Query Language engine.

Query Headers​

TABLE​

TABLE [WITHOUT ID] [expr [AS "Column Name"]], ...
  • Emits a structured tabular grid.
  • By default, includes file.name as the first column link. Use WITHOUT ID to suppress the automatic note column.

LIST​

LIST [expr]
  • Emits an unordered list of notes with optional computed text appended.

TASK​

TASK
  • Collects and renders checklist tasks embedded in notes matching the source and filter conditions.

Clauses​

FROM​

Specifies the initial universe of notes to include.

Source ExpressionMeaning
""All notes in the vault
#tagNotes containing #tag or nested #tag/*
"Folder"Notes located inside Folder/
[[Note Title]]Notes linking to [[Note Title]]
outgoing([[Note Title]])Notes linked from [[Note Title]]

Boolean Combinations: Sources can be combined with AND, OR, NOT, and parentheses:

FROM (#work OR #freelance) AND !"Archive"

WHERE​

Filters candidate rows by boolean predicates:

WHERE status = "in-progress" AND priority > 1

FLATTEN​

Unrolls an array into individual rows or binds a computed expression:

FLATTEN tags AS tag
FLATTEN length(file.inlinks) AS backlink_count

GROUP BY​

Partitions rows by field values into aggregate groups:

GROUP BY category
GROUP BY file.folder

Note: In grouped queries, note values are accessible via the rows collection (e.g. rows.file.name).

SORT​

Orders rows by one or more expressions:

SORT file.mtime DESC, rating ASC
  • Default direction is ASC (ascending).
  • Null values sort lowest in ascending order.

LIMIT​

Truncates output to at most n rows:

LIMIT 25

Expressions & Operators​

Operators​

OperatorTypeDescription
=, !=EqualityStrict equality / inequality
<, <=, >, >=RelationalComparison across typed values
AND, ORLogicalLogical conjunction and disjunction
NOT, !LogicalLogical negation
+, -ArithmeticNumeric addition / string concatenation

Built-in Functions​

FunctionSignatureDescription
containscontains(haystack, needle)Returns true if needle is in string or array
lengthlength(x)Returns array length or string character count

Aggregate Functions (GROUP BY context only)​

FunctionSignatureDescription
countcount(rows)Total rows in current group
lengthlength(rows)Synonym for count(rows)
sumsum(rows.<field>)Numeric sum of field across group
avg / averageavg(rows.<field>)Arithmetic mean
minmin(rows.<field>)Minimum value
maxmax(rows.<field>)Maximum value

Standard Note Properties (file.*)​

Every note row exposes these metadata fields:

FieldTypeDescription
file.namestringFile name without .md extension
file.pathstringFull path relative to vault root
file.folderstringDirectory containing the file
file.sizenumberSize in bytes
file.ctimedateCreation timestamp
file.mtimedateLast modified timestamp
file.tagsarrayAll tags in frontmatter and body
file.outlinksarrayLinks originating from this note
file.inlinksarrayBacklinks referencing this note
file.tasksarrayEmbedded checklist tasks