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.
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.
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
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 <boolean-switch> 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.
```
<spanclass="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>
```

#### Habit Counter
Use the <habit-counter> component to track numerical habits, such as how many coffees you had or how many cigarettes you smoked today.
```
<spanclass="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>
```

#### Text Input
Use the <text-input> component to display and optionally update text fields in your database.
```
<spanclass="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 -->