Skip to main content
Hypersphere
Article Cover

SQLSeal - SQL Engine for Your Obsidian Vault

Have you ever looked at your growing collection of notes and wished you could easily find answers in them? Maybe you're tracking movies to watch, keeping daily journals, or logging your expenses. Over time, these notes become treasure troves of personal information. But finding patterns or getting quick insights often means manually searching through dozens of files.

That's where SQLSeal comes in. It adds a powerful way to ask questions about your notes - like "What movies did I want to watch?" or "How did I spend my time last month?" - and get immediate answers. Right inside your Obsidian vault, no extra apps needed. Think of it as having a personal research assistant for your notes.

Below are some of the basic use-cases to get you started. If you want to follow along, you can download the SQLSeal Playground Vault where I included some data and queries to get you started.

What is Obsidian? #

Obsidian is a Note Taking app that allows you to write notes in Markdown. Thanks to extendability and huge community, you can customise it however you want using plathera of plugins. Unfortunately, until know there was no way to use SQL to query the data stored in your vault (that's the name Obsidian uses to describe collection of notes). Thanks to SQLSeal now you can do that!

Getting Started #

Install SQLSeal through Obsidian's Community Plugins. It works on both desktop and mobile devices.

Community Plugins - SQLSeal

Introduction #

SQLSeal allows you to use SQL accross your Obsidian Vault to perform queries. There are 2 main use-cases the plugin allows you to perform:

  • Query files in your vault by their names, properties and tags
  • Query any CSV file data

The plugin uses SQL to perform queries. If you already know SQL you should feel right at home, but if you're not familar with it just yet - don't worry. It is an industry standard where it comes to operating on data, so there are plenty of tutorials to help you get started. I recommend SQLBolt with their interactive lessons.

Basic Note Queries #

Let's start with querying vault files. Let's imagine the scenario where you mark your notes with TODO in the title to indicate you want to go back to them and finish writing them. Let's write a query that will help us with finding all of them.

To get started create a code block in your Obsidian note (using 3 backticks ` symbols) followed by sqlseal. Then type in the following query:

SELECT name, path
FROM files
WHERE name LIKE '%TODO%'

Codeblock in Obsidian

Querying by tags #

You can also query notes by tags associated to them. Tags are kept in a separate table so we need to join them with our table. If you're new to SQL, you can learn more about JOINS here.

SELECT name, path
FROM files JOIN tags
    ON files.path=tags.path
WHERE tags.name='#todo'

Working with CSV Files #

SQLSeal can integrate with any CSV files in your vault. Once enabled, these files appear as regular notes - with SQLSeal you can preview or even edit them directly in Obsidian.

Let's use a transportation.csv file that tracks daily commute data - including transport type, distance, and purpose.

Preview of the transport data file

Here's how to create a daily travel summary:

Result of the SQLSeal query

TABLE commute = file(/data/transport.csv)
HTML
SELECT
    transport_type,
    SUM(distance_km) AS total_distance,
    group_concat(purpose) as purposes
FROM commute
WHERE date = @date
GROUP BY transport_type

Key components in the code above:

  • TABLE statement: Creates a table from your CSV file, automatically updating when the file changes
  • HTML: Sets the display format (the default one we've seen in previous examples is GRID but you can also use HTML and MARKDOWN)
  • WHERE date = @date: Uses the current note's date property. Any property in your current note can be accessed using @ symbol, allowing you to create dynamic queries.

Practical example - track your daily spendings #

Personal finance often feels like a puzzle - money comes in, money goes out, but the patterns aren't always clear. This query helps you understand your daily spending habits:

TABLE expenses = file(/data/expenses.csv)
HTML
SELECT 
    category,
    SUM(amount) as total_spent,
    COUNT(*) as number_of_purchases,
    ROUND(AVG(amount), 2) as avg_per_purchase
FROM expenses
WHERE date = @date
GROUP BY category
ORDER BY total_spent DESC

Result of the SQLSeal query for expenses per day

Beyond just totaling your expenses, this query reveals your spending patterns. It shows not only how much you spent in each category but also how many purchases you made and the average amount per purchase. Maybe you'll notice those small coffee purchases adding up, or see that your grocery runs are less frequent but more efficient than you thought.

You can place this query in your daily note template, and it will automatically show your spending for each day. Combine this with weekly or monthly views, and you start building a clear picture of your financial habits. These examples show how SQLSeal transforms static data into actionable insights.

Additional Features #

There's much more functionality available in SQLSeal which we cannot cover in this article. Beyond things already discussed here, SQLSeal can also:

  • Handle advanced SQL syntax like Common Table Expressions (CTE)
  • Allows you to parametrise your queries with data from your properties
  • Allows you to edit your CSV files directly.

But that's not all. SQLSeal is under active development and there are some exciting extra features planned:

  • Chart support
  • Support for more data types
  • Inline queries
  • User-defined global tables
  • Easier database creation - similar to Notion Databases

Next Steps #

If you plan to use SQLSeal now, how about checking the full documentation and playing with the Playground Vault? If you want to stay in touch with updates to the library, have extra questions or a feature request, please joing our small-but-growing Discord Community. You can also subscribe to my newsletter below where I share updates on my projects, including SQLSeal and much more.