SQLite DB

by Stefano Frigerio
5
4
3
2
1
Score: 39/100

Description

Category: Data Visualization

The SQLite DB plugin allows users to interact with SQLite databases directly within Obsidian. It enables executing SQL queries, filtering data, and rendering query results in a structured format. Users can inspect table structures, extract data into notes, and generate visualizations such as pie, bar, and line charts. The plugin supports advanced filtering options, including date ranges and multiple conditions, making it useful for managing structured information within Obsidian.

Reviews

No reviews yet.

Stats

39
stars
2,519
downloads
1
forks
422
days
185
days
185
days
1
total PRs
0
open PRs
0
closed PRs
1
merged PRs
4
total issues
3
open issues
1
closed issues
0
commits

Latest Version

6 months ago

Changelog

Pushed some fixes for local db line charts and bundled Chart.js

README file from

Github

SQLite DB Plugin

The SQLite DB Plugin allows you to interact with SQLite databases directly within your Obsidian vault. You can execute SQL queries, generate charts from your data, inspect table structures, and even export table rows as notes.


Features

  • SQL Query Execution
    Write SQL queries in code blocks to fetch and render data from your SQLite database.
  • Natural Results Rendering
    See query results rendered as natural lists or in a custom format directly in your note.
  • Multiple Filters & Date Range Filtering
    Easily add multiple filter conditions and date ranges to your queries.
  • Chart Visualization
    Use the sql-chart code block to create charts (pie, line, or bar) based on your data.
  • Table Inspection & Data Export
    Inspect table structures and export table rows to new notes.

Configuration

  1. Open Obsidian Settings
    Navigate to Community Plugins and disable Safe Mode.
  2. Browse Community Plugins
    Search for SQLite DB Plugin, then click Install.
  3. Enable the Plugin
    In your Community Plugins list, enable the plugin.
  4. Download the .wasm file From the repository and put in the folder of the plugin (.obsidian/plugins/sqlite-db)

Once the plugin is installed, open Settings → SQLite DB Plugin to configure it. You can choose to work with either a local database file or a remote API, and optionally integrate with your daily notes or Cloudflare Access for secure API access.

🔀 Database Mode Choose whether the plugin interacts with a local SQLite file or a remote API server.

📁 Local Mode Settings Used when Database mode is set to Local. Here you can set your full absolute path to your .db SQLite file

🌐 Remote Mode Settings Used when Database mode is set to Remote. Ideal for syncing across devices or accessing a shared dataset via HTTP.

If you protect your API using Cloudflare Access, provide your Client ID and Client Secret here for automatic token-based login.

🗓️ Journal Settings These options help the plugin locate and manage your journal entries if you have some. This + the commands registered in the plugin allows you to dump the entries in your db into the folder or the other way round, upsert the journal you wrote in obsidian into your own DB.

This as other parts of the plugin requires you to setup a specific database schema for the tables


Usage

Codeblocks

SQL Code Blocks

Create a code block labeled with sql to run a SQL query. For example:

table: Tasks
columns: text, completed, due
filterColumn: completed, priority
filterValue: 0, high
dateColumn: due
startDate: 2024-01-01
endDate: 2024-12-31
orderBy: due
orderDirection: asc
limit: 10

This query will:

  • Select the text, completed, and due columns from the Tasks table.
  • Apply two filters: one on completed and another on priority.
  • Filter rows within the specified date range.
  • Order the result by the due column in ascending order.
  • Limit the number of rows to 10.

Below is a list of available parameters you can use in your SQL blocks:

Parameter Description Example
table Required. Name of the table to query. table: Tasks
columns Comma-separated columns to select. columns: id, text, due
filterColumn Column(s) to filter on. Can list multiple columns separated by commas. filterColumn: completed, priority
filterValue Filter value(s) for the corresponding columns in filterColumn. filterValue: 0, high
dateColumn Column containing date information for range filtering. dateColumn: due
startDate Starting date for filtering. startDate: 2024-01-01
endDate Ending date for filtering. endDate: 2024-12-31
orderBy Column to order the results by. orderBy: due
orderDirection Direction of sort (asc or desc). orderDirection: asc
limit Maximum number of rows to return. limit: 10
Chart Code Blocks

Create a code block labeled with sql-chart for visualizations. For example:

table: Time
chartType: pie
categoryColumn: tag
valueColumn: duration

Pie Chart

Parameters

Parameter Description Example
chartType Type of chart to create. chartType: pie
categoryColumn Column to use for the category in the chart. categoryColumn: priority
valueColumn Column to use for the value in the chart. valueColumn: completed

Each chart takes an optional chartOptions object that can be used to customize the different chart types:

Chart types


table: QuantifiableHabits
chartType: line

xColumn: date
yColumns: value
categoryColumn: habitKey

dateColumn: date
startDate: 2025-01-01
endDate: 2025-01-31

chartOptions: {
	fill: false,
	tension: 0.5,
	pointRadius: 4,
	showLegend: true,
	animations: true,
	yAxisMin: 0,
	yAxisMax: 10
}

table: QuantifiableHabits
chartType: bar

xColumn: date
yColumns: value
categoryColumn: habitKey

dateColumn: date
startDate: 2025-01-01
endDate: 2025-01-31

chartOptions: {
    stacked: true,
    horizontal: false,
    showLegend: true,
    animations: true,
    tooltips: true
}

table: Money
chartType: pie

categoryColumn: tag
valueColumn: amount

dateColumn: date
startDate: 2025-01-01
endDate: 2025-01-31

chartOptions: {
	showLegend: true,
	isDoughnut: true
}

Interactive Components

The plugin supports custom interactive HTML components you can embed in your notes to view and update data live. These components are initialized at runtime using your database settings. I wrote these to create interactive Periodic Notes, and update data in them accordingly

Boolean Switch

Use the component to create toggleable switches tied to boolean habit data. This lets you interact with your data directly from a note, such as marking a habit done or undone for a given day.

<span class="boolean-switch-placeholder"
  data-habit="Meditate"           <!-- the name of the habit in the db -->
  data-emoji="🧘"                 <!-- the emoji (only for display) -->
  data-date="2025-05-09"          <!-- the date associated with the specific row -->
  data-table="BooleanHabits"      <!-- the name of the table -->
  data-habit-id-col="habitKey"    <!-- the name of the column where the habit names are stored -->
  data-value-col="value"          <!-- the name of the column where the values are stored -->
  data-date-col="date">           <!-- the name of the column that holds the date -->
</span>

Boolean Switch

Habit Counter

Use the component to track numerical habits, such as how many coffees you had or how many cigarettes you smoked today.

<span class="habit-counter-placeholder"
  data-habit="Cigarettes"         <!-- the name of the habit in the db -->
  data-emoji="🚬"                 <!-- optional emoji for display -->
  data-date="2025-05-09"          <!-- the date associated with the specific row -->
  data-table="QuantifiableHabits" <!-- the name of the table -->
  data-habit-id-col="habitKey"    <!-- the column where the habit keys are stored -->
  data-value-col="value"          <!-- the column for storing numerical values -->
  data-date-col="date">           <!-- the column for storing dates -->
</span>

Habit Counter

Text Input

Use the component to display and optionally update text fields in your database.

<span class="text-input-placeholder" 
  data-table="DailyNotes"             <!-- Table where the value is stored -->
  data-date="@date"                   <!-- The date for the entry -->
  data-value-col="dayRating"          <!-- Column to store the input -->
  data-date-col="date"                <!-- Column storing the date -->
  placeholder="How do u feel today?"  <!-- Placeholder text when empty -->
  data-label="Day Rating 📈"          <!-- Label shown next to the input -->
/>

It supports both inline editing and a "button-triggered" modal input, making it versatile for journal prompts, mood logs, notes, or custom fields.

<span
  class="text-input-placeholder"
  data-table="DailyNotes"
  data-value-col="sleepTime"
  data-date-col="date"
  data-date="@date"
  data-is-button="true"              <!-- Makes it a button -->
  data-modal-type="time-picker"      <!-- On click opens a modal, time-picker or date-picker -->
  placeholder="Select Time"
  data-label="Sleep Time 💤" 
/>

Text Input

Similar Plugins

info
• Similar plugins are suggested based on the common tags between the plugins.
Advanced Random Note
3 years ago by Karsten Finderup Pedersen
Create commands from custom queries to open random notes
Charts
5 years ago by phibr0
Charts - Obsidian Plugin | Create editable, interactive and animated Charts in Obsidian via Chart.js
Charts View
5 years ago by caronchen
Data visualization solution in Obsidian, support plots and graphs.
Daily Note Metrics
a year ago by Andre-Diamond
Obsidian Plugin that parses Daily Notes and uses data to create charts
Data Fetcher
a year ago by qf3l3k
Fetch data from multiple sources (REST APIs, RPC, gRPC, GraphQL) and insert results into notes.
Datacore
8 months ago by Michael Brenan
Work-in-progress successor to Dataview with a focus on UX and speed.
Default query in backlinks
2 years ago by Benature
Financial Doc
3 years ago by Studio Webux
Financial Documentation and Tracking using CSV format and Chart.js directly in Obsidian
Hill Charts
2 years ago by stufro
Add Hill Charts to your Obsidian notes.
JSON Importer
4 years ago by farling42
Plug-in for Obsidian.md which will create Notes from JSON files
JSON table
3 years ago by Dario Baumberger
Simply switch between JSON and tables in your Obsidian notes.
MAKE.md
3 years ago by MAKE.md
Obsidian Query Language
5 years ago by Joost Plattel
An Obsidian plugin allowing you to query your notes
Ollama Chat
2 years ago by Brumik
A plugin for chatting with you obsidian notes trough local Ollama LLM instead of Chat GTP.
Oura Ring
5 years ago by Andrew Lombardi
Plugin to process data from Oura Ring
Plotly
5 years ago by Dmitriy Shulha
Obsidian plugin to embed Plotly charts into markdown notes.
PubScale
3 years ago by piriwata
An obsidian plugin for insert your note into a PlanetScale table
Query JSON
2 years ago by rooyca
Read, query and work with JSON inside Obsidian.
Ridian
a year ago by Michel Nivard
This is Ridian: R in Obsidian
Size History
3 years ago by Piotr Borowski
Graph with vault size over time
SQLSeal Charts
a year ago by hypersphere
Charting extension for SQLSeal Obsidian Plugin. Visualise your data!
TaskWarrior Task Wiki
2 years ago by SntTGR
Small and simple task manager widget for obsidian and powered by taskwarrior.
TinyChart
2 years ago by Alin Coop
Dead simple ASCII charts for Obsidian.
Vantage - Advanced search builder
5 years ago by ryanjamurphy
Vantage helps you build complex queries using Obsidian's native search tools.
Vega Visualizations
3 years ago by Justin Kim
Create Vega and Vega-Lite visualizations in https://obsidian.md/.
Vika Sync
4 years ago by romantic-black
Workout Planner
4 months ago by Rares Spatariu