147 lines
3.1 KiB
Markdown
147 lines
3.1 KiB
Markdown
---
|
|
title: Obsidian Dataview
|
|
category: Summary
|
|
type: Tool/Plugin
|
|
source: https://github.com/blacksmithgu/obsidian-dataview
|
|
date: 2026-02-23
|
|
tags: [obsidian, dataview, plugin, query, database]
|
|
---
|
|
|
|
# Obsidian Dataview
|
|
|
|
**URL:** https://github.com/blacksmithgu/obsidian-dataview
|
|
**Description:** A data index and query language over Markdown files for Obsidian
|
|
**Date Summarized:** 2026-02-24
|
|
|
|
---
|
|
|
|
## tl;dr
|
|
|
|
Treat your Obsidian Vault as a **database** that you can query. Query, filter, sort, and extract data from Markdown pages using YAML frontmatter and inline fields.
|
|
|
|
---
|
|
|
|
## What It Does
|
|
|
|
Dataview generates data from your vault by pulling information from:
|
|
|
|
1. **Markdown Frontmatter** — YAML at the top of documents:
|
|
```yaml
|
|
---
|
|
alias: "document"
|
|
last-reviewed: 2021-08-17
|
|
rating: 8
|
|
status: active
|
|
---
|
|
```
|
|
|
|
2. **Inline Fields** — Key:: Value syntax in documents:
|
|
```markdown
|
|
Basic Field:: Value
|
|
**Bold Field**:: Nice!
|
|
You can also write [field:: inline fields]
|
|
(field2:: hidden field)
|
|
```
|
|
|
|
---
|
|
|
|
## Query Modes
|
|
|
|
### 1. Dataview Query Language (DQL)
|
|
Pipeline-based, SQL-like expressions:
|
|
```dataview
|
|
TABLE file.name AS "File", rating AS "Rating"
|
|
FROM #book
|
|
SORT rating DESC
|
|
```
|
|
|
|
### 2. Inline Expressions
|
|
Embed directly in markdown:
|
|
`= this.file.name` → shows filename
|
|
|
|
### 3. DataviewJS
|
|
JavaScript for complex logic:
|
|
```dataviewjs
|
|
for (let group of dv.pages("#book")
|
|
.where(p => p["time-read"].year == 2021)
|
|
.groupBy(p => p.genre)) {
|
|
dv.header(3, group.key);
|
|
dv.table(["Name", "Rating"], group.rows
|
|
.sort(k => k.rating, 'desc')
|
|
.map(k => [k.file.link, k.rating]))
|
|
}
|
|
```
|
|
|
|
---
|
|
|
|
## Example Use Cases
|
|
|
|
**Table of games with metadata:**
|
|
```dataview
|
|
TABLE time-played, length, rating
|
|
FROM "games"
|
|
SORT rating DESC
|
|
```
|
|
|
|
**List by tags:**
|
|
```dataview
|
|
LIST FROM #game/moba or #game/crpg
|
|
```
|
|
|
|
**Tasks from active projects:**
|
|
```dataview
|
|
TASK FROM #projects/active
|
|
```
|
|
|
|
**Books read in 2021, grouped by genre:**
|
|
```dataviewjs
|
|
for (let group of dv.pages("#book")
|
|
.where(p => p["time-read"].year == 2021)
|
|
.groupBy(p => p.genre)) {
|
|
dv.header(3, group.key);
|
|
dv.table(["Name", "Time Read", "Rating"],
|
|
group.rows.sort(k => k.rating, 'desc')
|
|
.map(k => [k.file.link, k["time-read"], k.rating]))
|
|
}
|
|
```
|
|
|
|
---
|
|
|
|
## Key Features
|
|
|
|
- ✅ Query any Markdown files in your vault
|
|
- ✅ Filter by tags, folders, metadata
|
|
- ✅ Sort by any field
|
|
- ✅ Group results
|
|
- ✅ Render as tables, lists, or tasks
|
|
- ✅ JavaScript API for complex logic
|
|
- ✅ Inline fields for hidden metadata
|
|
- ✅ Automatic data index updates
|
|
|
|
---
|
|
|
|
## Potential Uses for Corey's Vault
|
|
|
|
1. **Home Assistant Automations Table** — Query all automations by status
|
|
2. **Projects Dashboard** — Active vs completed projects
|
|
3. **Daily Notes Query** — Recent entries, completed tasks
|
|
4. **Research Summaries** — All `/summarize` outputs by date
|
|
5. **Cron Jobs Status** — Active vs disabled jobs
|
|
|
|
---
|
|
|
|
## Installation
|
|
|
|
Available in Obsidian Community Plugins:
|
|
1. Settings → Community Plugins → Browse
|
|
2. Search "Dataview"
|
|
3. Install & Enable
|
|
|
|
---
|
|
|
|
**Full Docs:** https://blacksmithgu.github.io/obsidian-dataview/
|
|
|
|
---
|
|
|
|
*Source: https://github.com/blacksmithgu/obsidian-dataview*
|