Vault Queries
Query data from your Obsidian vault using DataGlass's built-in query language.
Heading Tables
Reference a table by its heading in the same note:
markdown
```dg
type: bar
data:
file: "#Revenue Data"
x: quarter
y: revenue
```The chart looks for a table under the "Revenue Data" heading:
markdown
## Revenue Data
| quarter | revenue |
|---------|---------|
| Q1 | 125000 |
| Q2 | 148000 |
| Q3 | 132000 |
| Q4 | 175000 |Query Syntax
Use query to search across your vault:
yaml
data:
query: "from:Projects where:status=active"Query Components
| Component | Example | Description |
|---|---|---|
from: | from:Projects | Folder to search |
where: | where:status=active | Filter condition |
tag: | tag:#project | Filter by tag |
Query Examples
All notes in a folder
yaml
data:
query: "from:Projects"Notes with specific frontmatter
yaml
data:
query: "from:Tasks where:priority=high"Notes with specific tag
yaml
data:
query: "from:Notes tag:#idea"Combined conditions
yaml
data:
query: "from:Work where:status=active tag:#priority"What Gets Queried
Vault queries return frontmatter properties from matching notes:
Note (Projects/Website Redesign.md):
markdown
---
status: active
budget: 50000
start_date: 2024-01-15
---
# Website Redesign
Project details...Query result row:
| file | status | budget | start_date |
|---|---|---|---|
| Website Redesign | active | 50000 | 2024-01-15 |
Chart from Vault Data
markdown
```dg
type: bar
data:
query: "from:Projects where:status=active"
x: file
y: budget
title: Active Project Budgets
```Heading Reference in Other Notes
Reference a table in a different note:
markdown
```dg
type: line
data:
file: "Reports/Q4 Summary.md#Sales by Month"
x: month
y: sales
```The path format is: path/to/note.md#Heading Name
Aggregating Vault Data
Combine queries with transformations:
markdown
```dg
type: pie
data:
query: "from:Tasks"
transformations:
- type: aggregate
configuration:
groupBy: ["status"]
count: ["file"]
x: status
y: file_count
title: Tasks by Status
```Tips
Frontmatter Required: Vault queries only return notes with frontmatter properties.
Performance: Queries scan matching notes on render. For large vaults, be specific with
from:.
Heading Tables: The heading must exactly match (case-sensitive).
Common Mistakes
Wrong: Heading without hash
yaml
data:
file: "Revenue Data" # Looks for a file named "Revenue Data"Right: Use hash for headings
yaml
data:
file: "#Revenue Data" # Looks for heading in current noteWrong: Query without from
yaml
data:
query: "where:status=active" # No folder specifiedRight: Include from clause
yaml
data:
query: "from:Projects where:status=active"See Also
- File Data - Load from specific files
- Inline Data - Embed data directly
- Transformations - Process query results