There have been multiple accounts created with the sole purpose of posting advertisement posts or replies containing unsolicited advertising.

Accounts which solely post advertisements, or persistently post them may be terminated.

A local database with a command line interface? (sqlite?)

Hi all,

I am looking for a local database that is easily accessible via the command line.

It can be SQL or non-SQL

Whats my use case? I want to use it kinda like a second brain. A place to save my notes, my todo lists, my book reading lists, links / articles to read later, etc.

I want it to be a good CLI citizen so that I can script its commands to create simpler abstractions, rather than writing out the full queries every time.

Maybe sqlite is what I need, but is that ideal for my use case?

Nibodhika ,

What if instead you used something that’s meant to be used to take notes but that also has querying capabilities?

I have been using Silverbullet for a while and I absolutely love it. It uses Markdown files in disk so it’s very easy to backup, have secondary instances running and even just edit files directly with any other program. But also provides some extra syntax to define objects and query them, so you can for example build a library of recipes and have a page that lists all of the ones that have a specific tag or take less than X time to cook or whatever.

tmk ,
@tmk@social.lugal.io avatar

@matcha_addict Anything beyond SQLite is too heavy, but if it were me I would use a lightweight wiki like dokuwiki. Having to run SQL to do all these sorts of things sounds like it would just get in the way of both getting and consuming your thoughts.

matcha_addict OP ,

I don’t think it would suffice. It would work for notes, but I want to also have a todo list in there, for example. Be able to check things off, query by due date, by assignee or task, etc.

Feyd ,
subignition ,
@subignition@fedia.io avatar

I don't think a database is a good fit for your use case at all, unless you're willing to reinvent a lot of wheels.

atzanteol ,

For todo stuff there’s the excellent “todo-txt” for cli use. Though not great for notes. Perhaps separate tools would be fine?

h0bbl3s , (edited )
@h0bbl3s@lemmy.world avatar

They aren’t exactly CLI but I really like obsidian for taking notes. It’s not open source though. Logseq is good too and is OSS. Both use markdown for formatting so if you are familiar with writing pages on GitHub you’ll have no trouble. Even if not markdown is super easy to learn. That and all of your data stays local and in open formats. I edit my stuff in a terminal anyway.

Just look up obsidian OSINT on YouTube you’ll find some good stuff on how to use it.

Another thought is just use markdown files and a directory structure in a private git repo. You’d be able to interact with it locally entirely in the terminal with vim etc and have the option of going online and searching or organizing etc. You could probably even use a cli browser for that part if you wanted.

AnnaFrankfurter ,

I wouldn’t recommend a DB for note taking purpose. You can use Markdown with vim.

OneCardboardBox ,

Are you an emacs user?

Try org-roam. It’s a similar system to obsidian, but fully open source. You have all the note-taking techniques of org-mode, and all the scripting power of emacs.

ZWQbpkzl ,

Is there a reason you’re not looking at tools explicitly built for this like orgmode, obsidian, task-warrior, etc? There’s a plethora of these tools and my experience with this is you really don’t want to over-engineer your productivity suite.

That said, if you go the SQL route, sqlite is the way to go. Other SQL databases must be run as a daemon whereas sqlite operates on a local file directly.

However any SQL database isnt going to have the CLI youre asking for. Its interface is… SQL, so you’re scripts are going to have a bunch of SQL code embedded that isnt easily reusable. A non-sql database will probably be better. I’m not familiar with them but I think there’s some that store their data as text files in a folder which is organized a certain way. But that starts looking like the tools I mentioned before.

audaxdreik ,

Check out www.giuspen.net/cherrytree/, lightweight note-taking app with interesting scripting function built in.

Even if that’s not your cup of tea, it has the option to save your notebook to a single sqlite file, so I take that as good enough proof it’ll work for your similar purposes as well.

Emperor ,
@Emperor@feddit.uk avatar

Counter-proposal: Perhaps use Obsidian instead?

floofloof ,

If you want something a bit more powerful than SQLite, MySQL and PostgreSQL both support CLI interactions and scripting too.

bionicjoey ,

Definitely sounds like sqlite.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • [email protected]
  • random
  • lifeLocal
  • goranko
  • All magazines