Dataview
Obsidian data query plugin using SQL-like DQL to query your vault as a database, generating tables, lists, calendars, and task views.
At a Glance & Reviews
Community Discussions (3)
- 玩转 Obsidian 08:利用 Dataview 打造自动化 HomePage 2022-06-24 · 30 pts
- Obsidian Dataview: Turn Obsidian Vault into a database you can query from 2022-05-17 · 211 pts
- 我的 Obsidian 工作流:模板+QuickAdd+Dataview 快速创建和自动索引 2021-08-17 · 30 pts
About Dataview
Dataview treats your Obsidian vault as a queryable database: it extracts and indexes metadata from note frontmatter (Properties) and inline fields, then uses an SQL-like query language or a JavaScript API to filter, sort, and aggregate data into lists, tables, and task views that update automatically as notes change. The plugin is free and open-source under the MIT license.
Key Features
· Data Extraction: Automatically reads Markdown frontmatter (YAML enclosed by --- at the top of a document) and inline fields (metadata written inline in the body using Key:: Value syntax).
· DQL Query Language: A pipeline-based, SQL-like expression language supporting list, table, task, and calendar query types, covering basic scenarios such as filtering, sorting, and grouping.
· Inline Expressions: Embed DQL expressions directly into body text to evaluate and display results in real time in Reading view.
· DataviewJS: A full-featured JavaScript API providing access to all of Dataview's indexed data along with convenient rendering utilities, offering far greater flexibility than the query language if you know JavaScript.
· Inline JS Expressions: The JavaScript counterpart to inline expressions, executing a short snippet of JS in body text and displaying the output.
· Task Aggregation: Use TASK queries to centrally list Markdown tasks scattered across individual notes by folder, tag, and other criteria.
Installation Guide
1. Open Obsidian → Settings → Community plugins → Browse.
2. Search for "Dataview" and click Install.
3. Enable the plugin after installation completes. No additional configuration is required once enabled; queries can be written directly in notes and will run.
Usage Guide
To run a query, first annotate your notes with metadata. There are two ways to do this:
1. Frontmatter: Enclose YAML with --- at the very top of a note, adding fields such as rating: 8, genre: fiction, last-reviewed: 2021-08-17, and so on.
2. Inline fields: Write "Basic Field:: Value" on any line in the body; write [field:: inline fields] to hide the key and show only the value, and write (field3:: value) to hide both the key and value.
Common queries (insert a dataview code block in any note):
1. Table query: Write `table time-played, length, rating from "games" sort rating desc` to list notes in the games folder as a table sorted by rating from highest to lowest, showing columns for time played, length, and rating.
2. List query: Write `list from #game/moba or #game/crpg` to list notes tagged with either of those two tags.
3. Task query: Write `task from #projects/active` to aggregate all incomplete Markdown tasks under that tag.
4. Display dynamic values inline: Write `= this.file.name` in body text to automatically replace it with the current note's file name in preview; the JS version is `$= dv.current().file.mtime`, which displays the page's last modified time.
Notes
· JavaScript queries (DataviewJS and inline JS expressions) have the same permissions as any Obsidian plugin and can theoretically rewrite, create, or delete files and make network requests; only run scripts you wrote yourself or that come from a trusted source you understand. Ordinary DQL queries run in a sandbox, are read-only, and will not make adverse changes to your vault.
· For the complete syntax, functions, and more examples, see the official documentation site (blacksmithgu.github.io/obsidian-dataview).
Frequently Asked Questions
Is Dataview free?
Yes. Dataview is free to use. Check the official site for current plans and limits.