Obsidian Vault Can Now Run SQL (and Your Agent Can Read It)

articsputnik1 pts0 comments

Your Obsidian Vault Can Now Run SQL (and Your Agent Can Read It)New: The AI Analytics Eval Field GuideGet the Free Playbook

START FREE

GO BACK TO BLOG

Your Obsidian Vault Can Now Run SQL (and Your Agent Can Read It)<br>2026/06/04 - 6 min read<br>BYMehdi Ouazza

GO BACK TO BLOG

Your Obsidian Vault Can Now Run SQL (and Your Agent Can Read It)<br>2026/06/04 - 6 min read<br>BYMehdi Ouazza

Obsidian has been having a moment lately, and a big chunk of it comes from one design decision: file over app. There is no proprietary format, no cloud lock-in. Your notes are markdown files sitting on disk, and Obsidian is just a viewer on top of them. Close the app, open the folder in Neovim or VS Code, everything is still there.

That decision is also why Obsidian quietly became one of the best playgrounds for AI agents.

If you prefer watching over reading, there's a full demo walkthrough on YouTube covering everything in this post.

Why Obsidian and AI fit together<br>Three things happened.<br>First, Karpathy shared his "LLM knowledge base" setup back in April: he points his agents at a local folder of markdown, they build and maintain a wiki, and he browses it through Obsidian. There are many ways to pair Obsidian with AI, but this one stuck with a lot of people because it needs zero infrastructure. It's just files.<br>Second, agents love markdown. The skills framework is markdown. Agent instructions are markdown. It turned out to be a really good middleware between humans and agents, and that's been Obsidian's native format since day one.<br>Third, the plugin ecosystem exploded. Obsidian has thousands of community plugins (you can run a full Excalidraw canvas inside it), and with AI making plugin development accessible to anyone, submissions went through the roof. The team was getting a new plugin PR roughly every 6 hours. Their answer, detailed in their future of plugins post: a developer dashboard with automated review. Submit your plugin, automated checks run (warnings, errors), and your published plugin gets a public health score. The one we're about to talk about sits at 97%.<br>So we built one: a DuckDB + MotherDuck plugin for Obsidian.

What it does<br>You write a SQL block in any note, run it, and freeze the result as a plain markdown table right under the query. The note becomes a self-contained document: query and result, readable in any editor, by any human, by any agent.<br>DuckDB runs locally via WASM (no install, no server), and if you add a MotherDuck token you can query your cloud data from the same note.

Wait, isn't that Dataview?<br>Fair question, Dataview is the go-to plugin for querying your vault. But it solves the opposite problem: Dataview queries the notes themselves (frontmatter, tags, links), while this plugin pulls external data into your notes via SQL.

Use Dataview for "list every note tagged #project, sorted by created date"

Use this for "the latest revenue numbers from my warehouse, joined with a local expenses CSV"

And yes, you can join across sources: a local CSV sitting in your data folder with a cloud table in MotherDuck, in one query.

Quick start<br>Install from Settings > Community plugins , search for "DuckDB and MotherDuck".<br>Then paste this into any note:<br>Copy code

```duckdb<br>SELECT<br>o_orderpriority AS priority,<br>count(*) AS orders,<br>round(sum(o_totalprice), 2) AS revenue<br>FROM read_parquet('https://shell.duckdb.org/data/tpch/0_01/parquet/orders.parquet')<br>GROUP BY 1<br>ORDER BY revenue DESC<br>```<br>In reading mode the block renders as a SQL panel with Run, Freeze, and Clear freeze buttons. DuckDB WASM range-reads the parquet over HTTP, no token needed. It works with anything DuckDB reads: Parquet, CSV, JSON, Excel, Iceberg, Delta, geospatial files.<br>Hit Freeze and the result drops in as a markdown table, bracketed by sentinel comments so the next refresh knows what to replace:<br>Copy code

| priority | orders | revenue |<br>| --- | --- | --- |<br>| 2-HIGH | 3065 | 434187711.87 |<br>| 4-NOT SPECIFIED | 3024 | 428175171.06 |<br>| 1-URGENT | 3020 | 426348805.57 |

The sentinel carries a query hash, connection, timestamp, and row count. In raw mode it's still just markdown: it diffs cleanly in git and renders everywhere, including mobile previews.<br>For cloud data, swap the fence to motherduck. Every MotherDuck account has the shared sample_data database attached, so this works out of the box:<br>Copy code

```motherduck<br>SELECT<br>type,<br>count(*) AS items,<br>round(avg(score), 1) AS avg_score<br>FROM sample_data.hn.hacker_news<br>WHERE type IS NOT NULL<br>GROUP BY 1<br>ORDER BY items DESC<br>```<br>Both connections can live side by side in the same note. Local DuckDB for files on disk, MotherDuck when you need cloud tables or want to push heavy SQL off your laptop. If you don't have an account yet, you can start with MotherDuck for free.

Scheduled refresh<br>Frozen tables go stale, so the plugin has scheduling built in. Pick daily or weekly in the dropdown above any block, and the plugin writes a property to the note's frontmatter:<br>Copy code

duckdb-motherduck-refresh:...

obsidian plugin motherduck duckdb markdown note

Related Articles