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?

Edit: removed notes, as evidently they aren’t suitable for this and aren’t like the rest.

  • Anna@lemmy.ml
    link
    fedilink
    arrow-up
    34
    ·
    4 months ago

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

  • ZWQbpkzl [none/use name]@hexbear.net
    link
    fedilink
    English
    arrow-up
    19
    ·
    4 months ago

    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.

    • matcha_addict@lemy.lolOP
      link
      fedilink
      English
      arrow-up
      2
      ·
      4 months ago

      Task warrior was close to what I wanted. I forgot what it lacked when I tried it. I think it was dependent tasks or sub tasks? If not that, then a tag system with flexible querying. I want querying by tag, due date, and other attributes to be possible.

      I think orgmode may be what I want, but the learning curve was discouraging. I was also discouraged about the possibility for myself to build extensions for it, for example to use on android. That would be easier with sql.

      Obsidian is gui from my understanding, so it wouldn’t fit what I’m looking for. I want something I can integrate with my scripts and other unix tools.

      • ZWQbpkzl [none/use name]@hexbear.net
        link
        fedilink
        English
        arrow-up
        1
        ·
        4 months ago

        Yeah I only suggested obsidian because its so popular and is completely out-of-the-box.

        If you want everything exactly as you want it you’ll need to spend time coding it all yourself. Otherwise you’re shopping around for different tools for specific things. Some editor plugin for notes. Another for tasks. Another for reminders etc.

        My issue with task warrior was its syncing service taskd. It required that you generate a self signed ssl certificate. You couldn’t host it behind caddy. But all the issues listed I’m pretty sure it covers. Its extremely robust.

  • OneCardboardBox@lemmy.sdf.org
    link
    fedilink
    English
    arrow-up
    14
    ·
    edit-2
    4 months ago

    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.

  • cy_narrator@discuss.tchncs.de
    link
    fedilink
    arrow-up
    13
    ·
    4 months ago

    Using a database for notes is like going 2km in a plane.

    You can use any relational database for this though but why would you subject yourself to this?

  • tmk@social.lugal.io
    link
    fedilink
    arrow-up
    8
    ·
    4 months ago

    @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@lemy.lolOP
      link
      fedilink
      English
      arrow-up
      1
      arrow-down
      1
      ·
      4 months ago

      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.

      • subignition@fedia.io
        link
        fedilink
        arrow-up
        13
        ·
        4 months ago

        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.

        • matcha_addict@lemy.lolOP
          link
          fedilink
          English
          arrow-up
          2
          ·
          4 months ago

          What would then? I haven’t found anything that has command line interface and supports dependent tasks and a flexible, queryable tag system

          • subignition@fedia.io
            link
            fedilink
            arrow-up
            1
            ·
            4 months ago

            I’m sorry, I don’t have a suggestion. If it were me I would not be looking at a CLI solution for this at all.

      • atzanteol@sh.itjust.works
        link
        fedilink
        English
        arrow-up
        5
        arrow-down
        1
        ·
        4 months ago

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

        • matcha_addict@lemy.lolOP
          link
          fedilink
          English
          arrow-up
          1
          ·
          4 months ago

          Todo txt lacked some features I needed, which would be trivial to implement as a SQL column.

          I do not remember what it was… Maybe it was dependent tasks? I believe so.

  • Daeraxa@lemmy.ml
    link
    fedilink
    arrow-up
    7
    ·
    4 months ago

    Joplin is a note taking app that stores its data in an sqlite database (easy to query but not a good idea to write to it) but there is also a command line version and both versions support access via a data API.

  • terminal@lemmy.ml
    link
    fedilink
    arrow-up
    7
    ·
    4 months ago

    I think you would be better off using something like org-roam. It’s all text so script can still be used and it can be searched fast with ripgrep. Also org mode has loads of features that a homegrown system will never be able to catch up with

    • matcha_addict@lemy.lolOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      4 months ago

      I think what I’m looking for doesn’t exist, but what I meant by CLI is something I can pipe things into and interface with other unix tools easily.

      But you’re right, they all have a way to open a session via CLI.

  • csm10495@sh.itjust.works
    link
    fedilink
    English
    arrow-up
    5
    ·
    4 months ago

    Unless your lists are 1000s of items long, just use text files in a folder.

    Could even go fancy and use markdown.

    • matcha_addict@lemy.lolOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      4 months ago

      I definitely considered this approach. The only problem is it is difficult to represent linking items to each other. For example, dependent tasks or sub tasks.

  • Nibodhika@lemmy.world
    link
    fedilink
    arrow-up
    5
    ·
    4 months ago

    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.

  • audaxdreik@pawb.social
    link
    fedilink
    arrow-up
    4
    ·
    4 months ago

    Check out https://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.

  • gramgan@lemmy.ml
    link
    fedilink
    arrow-up
    3
    ·
    4 months ago

    Hey!

    I’ve wanted something very similar—specifically, a plain-text database. I recently came across GNU recutils, which I haven’t had time to play around with yet, but which seems like it fits the bill (at least for me). There’s a couple YouTube videos on it—I encourage you to check it out!