Emacs comes with a SQL interpreter which is able to open a connection to databases and present you with a prompt you are probably familiar with (e.g. mysql>
, pgsql>
, trino>
, etc.). This mode gives you the ability to do that for Trino.
The canonical repository for the source code is https://github.com/regadas/sql-trino.
The recommended way to install the package is to utilize Emacs’s package.el
along with MELPA. To set this up, please follow MELPA’s getting started guide, and then run M-x package-install sql-trino
.
(package! sql-trino)
Download the Trino CLI, rename it to trino
and put it in your $PATH
.
Within Emacs, run M-x sql-trino
. You will be prompted by a minibuffer for a server. Enter a server and you should be greeted by a SQLi buffer with a trino>
prompt.
From there you can either type queries in this buffer, or open a sql-mode
buffer and send chunks of SQL over to the SQLi buffer with the requisite key-chords.
org-mode
support is available through the usage of ob-sql-mode, a sql-mode
backend for Org Babel.
Check ob-sql-mode
installation section.
(package! ob-sql-mode)
#+begin_src sql-mode :product trino prepare customers from select c_customer_id from sf100000.customer limit ?; #+end_src
#+begin_src sql-mode :product trino execute customers using 1; #+end_src
Please open GitHub issues and pull requests.