Query Nodes
Query nodes load data from files and feed it to connected charts.
What Query Nodes Do
A query node reads a CSV or JSON file and caches the data. Connected chart nodes receive this data through canvas edges. The query node displays a preview table showing the first rows.
Creating a Query Node
Edit your canvas file and add a text node with dgExtension:
{
"id": "query-sales",
"type": "text",
"text": "## Sales Data\n\nSource: `data/sales.csv`",
"dgExtension": {
"nodeType": "query",
"query": "file: data/sales.csv"
},
"x": 0,
"y": 0,
"width": 400,
"height": 300
}Query Configuration
The query property specifies the data source:
file: data/sales.csvSupported Formats
| Format | Extension | Example |
|---|---|---|
| CSV | .csv | file: data/sales.csv |
| JSON | .json | file: data/metrics.json |
File Resolution
DataGlass searches for files in this order:
- Exact path from vault root
- Inside
data/folder
If you specify file: sales.csv, DataGlass first tries sales.csv, then data/sales.csv.
Preview Table
Query nodes display a preview of loaded data:
- First 5 rows
- First 5 columns
- Total row count
This helps verify the correct file loads before connecting charts.
Connecting to Charts
Draw a canvas edge from the query node to a chart node. The chart must have data: { upstream: true } in its configuration.
[Query: sales.csv] ──edge──> [Chart: bar]One query can connect to multiple charts. Each receives the same data.
Data Caching
Query results cache for 60 seconds:
- Multiple charts share one query result
- Fast chart re-renders
- Reduced file reads
The cache clears when you close the canvas or the plugin unloads.
Troubleshooting
| Problem | Cause | Solution |
|---|---|---|
| No preview table | File not found | Check file path and extension |
| Empty preview | File empty or malformed | Validate CSV/JSON format |
| Wrong data | Wrong file path | Verify path in query config |