https://github.com/regadas/sql-trino
Adds Trino support to SQLi mode.
https://github.com/regadas/sql-trino
emacs emacs-package sql-mode trinodb
Last synced: 10 months ago
JSON representation
Adds Trino support to SQLi mode.
- Host: GitHub
- URL: https://github.com/regadas/sql-trino
- Owner: regadas
- License: gpl-3.0
- Created: 2022-04-28T13:45:58.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2023-11-22T14:10:59.000Z (over 2 years ago)
- Last Synced: 2024-10-15T17:56:28.203Z (over 1 year ago)
- Topics: emacs, emacs-package, sql-mode, trinodb
- Language: Emacs Lisp
- Homepage:
- Size: 24.4 KB
- Stars: 2
- Watchers: 3
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.org
- License: LICENSE
Awesome Lists containing this project
README
#+TITLE: sql-trino.el
#+AUTHOR: Filipe Regadas
#+OPTIONS: num:nil
#+OPTIONS: H:0
** What is it?
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.
** How do I get it?
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 [[https://melpa.org/#/getting-started][getting started guide]], and then run =M-x package-install sql-trino=.
*** Doom Emacs
#+begin_src emacs-lisp
(package! sql-trino)
#+end_src
** Requirements
Download the [[https://repo1.maven.org/maven2/io/trino/trino-cli/378/trino-cli-378-executable.jar][Trino CLI]], rename it to =trino= and put it in your =$PATH=.
** How do I use it?
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 usage
=org-mode= support is available through the usage of [[https://github.com/nikclayton/ob-sql-mode][ob-sql-mode]], a =sql-mode= backend for Org Babel.
**** Install
Check =ob-sql-mode= installation [[https://github.com/nikclayton/ob-sql-mode#installation][section]].
***** Doom Emacs
#+begin_src emacs-lisp
(package! ob-sql-mode)
#+end_src
**** Example
#+begin_example
,#+begin_src sql-mode :product trino
prepare customers
from
select c_customer_id
from sf100000.customer
limit ?;
,#+end_src
#+end_example
#+begin_example
,#+begin_src sql-mode :product trino
execute customers using 1;
,#+end_src
#+end_example
** Contributing
Please open GitHub issues and pull requests.