Use better-sqlite3 to give obsidian the ability to manipulate sqlite3 databases

Overview

OBSIDIAN-SQLITE3

Use better-sqlite3 to give obisidian the ability to manipulate sqlite3 databases.

Intention

Currently the linkage between obsidian and zotero requires the use of zotero's Better BibTeX for Zotero plugin, which is a inelegant way. Wouldn't it be nice if I could access zotero's database directly?

At the same time, obsidian has all the data in the md file, which is perfect. But I would like to link with other software like zotero, sioyek, notion, sticky note etc. that use sqlite3 as data storage. Through the api exposed by this plugin, other developers can easily call other software's database. In fact, I would like obsidian to integrate this feature to give ob more ways to store data, so as not to pollute the md file at the same time, bringing more possibilities. The work I did was trivial, just exposing two functions of better-sqlite3.

Why not integrate the better-sqlite3 library into a functional plugin?

Because this library is not like other libaray, npm install and that's it. For developers, you need to install the node gyp build environment, python, MS2022, .net tools, and a bunch of unknown errors. In particular, the binding.js of better-sqlite3 should be modified when packaging. This can be a very annoying thing for windows development. I don't want to have to do it again, how nice for other developers to call it directly.

So what is the use of this plugin?

  • Linking with other software that uses sqlite.
  • Store some dirty persistent data, such as the hash of each note, pollute md generic syntax of other syntax, etc.
  • Store things that are not easy to write in md, or don't want to write in md format, such as bookmarks, time tracker, etc.

Usage

Use default database

This plugin will create obsidian.db in the .obsidian directory by default, which is the default sqlite file. You can get an instance of this database through the api:

//Get the instanse of default database
const db = app.plugins.getPlugin["obsidian-sqlite3"].getDefaultDb()

//Some operations on the database

//close database
db.close()

Use other database

You can also create your own sqlite3 database file or get other software's sqlite3 file:

const db = app.plugins.getPlugin["obsidian-sqlite3"].initDatabase("D:/temp/custom-db.db", { verbose: console.log })

db.close()

Then you can read the better-sqlite3 api doc, do anything you want.

Install

From Obsidian

  1. Open Settings > Third-party plugin.
  2. Make sure Safe mode is off.
  3. Click Browse community plugins.
  4. Search for this plugin.
  5. Click Install.
  6. Once installed, enable the plugin and close the community plugins window.
  7. Go to plugin assets page, download the corresponding better_sqlite3.node zip file and unzip this file.
  8. Copy better-sqlite3.node file into the path ".obsidian/".

Tips:

  • For Mac: 103-darwin-arm64.zip.
  • For Linux: 103-linux-x64.zip.
  • For windows: 103-win32-x64.zip.

If you need another compiled version, please download it from the better-sqlite3 repo.

From GitHub

  1. Download the Latest Release from the Releases section of the GitHub Repository.
  2. Put files to your vault's plugins folder: .obsidian/plugins/obsidain-sqlite3
  3. Reload Obsidian.
  4. If prompted about Safe Mode, you can disable safe mode and enable the plugin. Otherwise, head to Settings, third-party plugins, make sure safe mode is off and enable the plugin from there.
  5. Go to plugin assets page, download the corresponding better_sqlite3.node zip file and unzip this file.
  6. Copy better-sqlite3.node file into the path ".obsidian/".
You might also like...

A package to manipulate string.

A package to manipulate string.

A package to manipulate string. Instalation use this command to installation npm install best-string imports import BestString from 'best-string' //o

Nov 17, 2022

Snipes Test Flight apps. Configurable & has the ability to use a burner account for checking the status to avoid bans.

Snipes Test Flight apps. Configurable & has the ability to use a burner account for checking the status to avoid bans.

TestFlight Sniper Snipes TestFlight beta apps. Configurable & has the ability to use a burner account for checking the status to avoid bans. Features

Dec 20, 2022

A tiny cross-platform client for SQLite3, with precompiled binaries as the only third-party dependencies.

A tiny cross-platform client for SQLite3, with precompiled binaries as the only third-party dependencies.

Tiny SQLite3 A tiny cross-platform client for SQLite3, with precompiled binaries as the only third-party dependencies. A nice feature about this modul

Oct 27, 2022

Cooperative databases using smart contracts.

Cooperative databases using smart contracts.

Vitra ██╗ ██╗██╗████████╗██████╗ █████╗ ██║ ██║██║╚══██╔══╝██╔══██╗██╔══██╗ ██║ ██║██║ ██║ ██████╔╝███████║ ╚██╗ ██╔╝██║ ██║ ██╔══██╗██

Dec 30, 2022

A multipurpose transporting app that contains, loads databases, documentation and more.

TransportingApp This project was generated with Angular CLI version 12.0.3. Development server Run ng serve for a dev server. Navigate to http://local

Jan 21, 2022

E-Commerce solution for security of databases and transactions.

commerce_new_era AMAÇ Amacımız günümüzde E-Ticaret sitelerinde bulunan sahte ürünlerin ve mağduriyetlerin önüne geçmektir. Bunu yapmak için Blockchai

May 14, 2022

🍉 Water is a micro-ORM + QueryBuilder designed to facilitate queries and operations on PostgreSQL databases designed to work in Melon

🍉 Water Water is a micro-ORM + QueryBuilder designed to facilitate queries and operations on PostgreSQL databases designed to work in MelonRuntime In

Aug 6, 2022

CDK construct to periodically take snapshots of RDS databases, sanitize them, and share with selected accounts.

CDK Construct for RDS Sanitized Snapshots Periodically take snapshots of RDS databases, sanitize them, and share with selected accounts. Use this to a

Dec 7, 2022

Preserve `localStorage` in databases.

PLS Preserve localStorage in databases. Features No adapter dependency is loaded by default. Possible to write/contribute your own adapters. Currently

Nov 3, 2022
Owner
cloud
cloud
A plugin for Obsidian (https://obsidian.md) that adds a button to its search view for copying the Obsidian search URL.

Copy Search URL This plugin adds a button to Obsidian's search view. Clicking it will copy the Obsidian URL for the current search to the clipboard. T

Carlo Zottmann 6 Dec 26, 2022
Obsidian jTab adds the ability to show guitar chords and tabs directly in your notes.

Obsidian jTab Guide Obsidian jTab adds the ability to show guitar chords and tabs directly in your notes. It uses the jTab library to render the chord

David 24 Dec 25, 2022
An obsidian plugin that give additional features to code blocks.

Obsidian Advanced Codeblock Add additioinal features to code blocks. Demo Feature Add line numbers to code block Add line highlight to code block Usag

lijyze 29 Jan 3, 2023
IPLD transaction as CAR buffer [for use in databases]

car-transaction IPLD transaction as CAR buffer that can be used as a database transaction. Usage import Transaction from 'car-transaction' const run

Mikeal Rogers 12 Sep 17, 2022
A Drag-and-Drop library for all JavaScript frameworks implementing an enhanced transformation mechanism to manipulate DOM elements

JavaScript Project to Manipulate DOM Elements DFlex A Drag-and-Drop library for all JavaScript frameworks implementing an enhanced transformation mech

DFlex 1.5k Jan 8, 2023
A simple to-do app for managing daily tasks built with Webpack, JavaScript, HTML, and CSS with the functionality to manipulate multiple completed tasks and store them to local storage.

TODO LIST APP In this project, I have built a simple HTML list of To Do tasks. The list is styled according to the listed specifications . This simple

Selma Belhadj 8 Jun 7, 2022
Ready to manipulate partitions file? Create a custom partition, apply custom security system, hide the partition and share your hidden data on the www

Paranoia ?? Ready to manipulate partitions file? Create a custom partition, apply custom security system, hide the partition and share your hidden dat

Alice Snow 3 Dec 29, 2022
Hash.js is a 0.5 KB script that lets you in a super simple way manipulate everything behind # in urls.

Hash.js - URL Hash Manipulation Hash.js is a 0.5 KB script that lets you in a super simple way manipulate everything behind # in urls. Tested in lates

Jonny Strömberg 152 Aug 1, 2022
Manipulate the AST to transform your code.

unplugin-ast Manipulate the AST to transform your code. Installation npm i unplugin-ast Vite // vite.config.ts import AST from 'unplugin-ast/vite' ex

三咲智子 32 Dec 3, 2022
Manipulate Clipboard in Node.js via native API.

@napi-rs/clipboard Manipulate Clipboard in Node.js via native API. It's a Node.js binding for 1Password/aboard API Text import { Clipboard } from '@na

LongYinan 64 Nov 7, 2022