reddit / emacs

Emacs native sqlite support and markdown fenced sql code block

JohnDoe365 · 2022-04-12 08:54
I learned that recent Emacs (is it 28.1? I am using bleeding edge 29.0) gained native support for sqlite datebases, `sqlite-mode-open-file` works great. Can I combine this with markdown fenced code block in a way that ```sql select 1; ``` is using a sqlite-Database? The same question applies in principle to org-mode too, where such a functionality would be fantastic too.
tecosaur · 2022-04-12 09:06
`ob-sqlite.el` already exists.
ieure · 2022-04-12 14:52
Native SQLite support is serving a different usecase; it's there to let Emacs Lisp programs persist data. Some packages need a persistent store (like elfeed) and this might present a better option than the current approach of printing a large Lisp data structure to a file on disk. If you want to write queries, Org Babel has supported this for years, and the new SQLite feature doesn't change that at all. Far as I know, there isn't an equivalent to Org Babel implemented in Markdown.
paretoOptimalDev · 2022-04-12 16:32
I don't know of any packages that let you execute markdown code blicks, but you could: - write your queries in org-mode - have a yasnippet where `sql<tab>` puts you in a code block to avoid typing "begin_src sq..." - export your org document code and result blocks to markdown