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.
Absolutely perfect. And part of why I’ve grown to love it.