Skip to content

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:

json
{
  "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:

yaml
file: data/sales.csv

Supported Formats

FormatExtensionExample
CSV.csvfile: data/sales.csv
JSON.jsonfile: data/metrics.json

File Resolution

DataGlass searches for files in this order:

  1. Exact path from vault root
  2. 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

ProblemCauseSolution
No preview tableFile not foundCheck file path and extension
Empty previewFile empty or malformedValidate CSV/JSON format
Wrong dataWrong file pathVerify path in query config

Released under the MIT License. Built by Boundary Lab.