Search code examples
databasepostgresqlemacselisp

How can I execute a SQL query in emacs lisp?


I want to execute an SQL query and get its result in elisp:

(let ((results (do-sql-query "SELECT * FROM a_table")))
     (do-something-with results))

I'm using Postgres, and I already know all of my connection information (host, username, password, db et al) I just want to execute the query and get the result back, synchronously.


Solution

  • I haven't tried it, but pg.el looks promising.