Hi, has anyone encountered this error setting up emacs with (package-initialize) and installing use-package?
Failed to verify signature archive-contents.sig:
No public key for 645357D2883A0966 created at 2024-12-06T15:35:02+0530 using EDDSA
Command output:
gpg: Signature made Friday 06 December 2024 03:35:02 PM IST
gpg: using EDDSA key 0327BE68D64D9A1A66859F15645357D2883A0966
gpg: Can't check signature: No public key
I tried running gpg --homedir ~/.emacs.d/elpa/gnupg --receive-keys 0327BE68D64D9A1A66859F15645357D2883A0966 but it returns gpg: keyserver receive failed: No data and doesn't help.My initialization looks like this:
(setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3")
(package-initialize)
(package-refresh-contents)
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package))
(require 'use-package)
(setq use-package-verbose t)
(setq-default use-package-always-ensure t)I've seen gpg errors quite a few times, but it is usually fixes by removing some caches, don't remember exactly.
when I've hit this, I had to
• M-: (setq package-check-signature nil)
• M-x package-refresh-contents
• M-: (setq package-check-signature 'allow-unsigned)
@luandy64 That helped, thanks! @alexyakushev I was trying to do a fresh setup, so I hardly had any cache.
EmacsConf 2024 starts tomorrow, what talks are you interested in? https://emacsconf.org/2024/talks/
I'm particularly looking forward to https://emacsconf.org/2024/talks/org-update and https://emacsconf.org/2024/talks/shell.
I'm looking forward to the former as well, and the Rust talk: https://emacsconf.org/2024/talks/rust. 😄
How do you work with sql and postgres in emacs? I just spent like 2 hours trying to get sq-ls installed so it worked with my spacemacs sql layer setup and it's not working (i can share details but basically emacs keeps re-prompting me to restart sql-ls no matter what i do or install). I'm about ready to just default to using pgadmin anytime I have to touch a sql file. I'm open to suggestions or sql life advice.
ah, proper org-babel work. nice
wider discussion: https://www.reddit.com/r/emacs/comments/1hbi751/passing_data_between_org_source_blocks_a
I still use IntelliJ for connecting to databases.
@drewverlee I used to use vim-dadbod https://github.com/tpope/vim-dadbod. When I migrated to emacs I started looking and found ejc-sql and started using it. I haven't explored much of other options though. But when I need more involved things I use dbeaver. I mean when I need to explore pg functions, diagrams etc.
Thanks for the insights. I'm well armed with a couple good choices now.
M-x sql-postgres
... enter connections details
... enter low level SQL
Everything else from Clojure using same stuff as in the program I'm developing.
what is sq-ls?
I'm reasonably happy using sql-connection-alist, ~/.pgpass, and org-babel to poke at things, but that might not be enough for all
after doing M-x sql-postgres and connecting, I then do C-c C-c in an sql-mode buffer to send that sql to the inferior process and run it - so the workflow is a lot like writing clojure code in a '(comment ,,, )' block. Sometimes I've had to run sql-set-sqli-buffer in the sql buffer to wire it to the right inferior process, but I think that's only when I've been connecting to multiple dbs.
sql-postgres is where it's at for me.
The only annoyance is I've not figured out how to connect to two different postgres DBs so I can go back and forth between dev / production replica to compare query plans.
(FWIW put connection details for projects in .dir-locals.el )
you can connect to multiple dbs by running C-u M-x sql-postgres. In the sql buffer you need to clear the local variable sql-buffer then use sql-set-sqli-buffer to select the one you want to send sql to. I usually put -- (setq-local sql-buffer nil) in the sql file and eval it with C-x C-e and then run sql-set-sqli-buffer-generally from the target sql buffer to update the buffers I've cleared. You can check where the sql will go when you run it with C-c C-z to show the target sql buffer. It's very easy to mess up, but I don't do it a lot, so I've never tried to fix it 😉
This might also be of interest to everyone here (happening Sunday): https://emacsconf.org/2024/talks/pgmacs/
^ "show me the code" https://github.com/emarsden/pgmacs
The advantage of sql inferior buffers for me is the number of different dbs supported. I've used it to work with mysql, pg, oracle, informix and others. Although, in recent years pgsql has become the default choice. I'd not heard of pgmacs before. It looks pretty cool. I might have to add it to the list of things to check out 😉. Thanks
I may suggestion you to access postgredb from emacs by repl of clojure with honeysql DSL, as it can do all what you are going to query and more step you can transform your data to any format using the tools clojure and libs offer
I do both. Depends on what I'm doing. I do some honeysql and clerk as well. I like it
I have something similar to the "Macros make your life easier" section here: https://dev.to/viglioni/emacs-as-sql-client-with-lsp-143l (and use sql-connect)
thanks, sql-postgres seems very useful.
> what is sql-ls? It's something my emacs setup tells me "restart" when ever i open a sql file. Likely beacuse i have the spacemacs https://www.spacemacs.org/layers/+lang/sql/README.html. I think it's talking about the lsp support, and so it should talking about https://github.com/sqls-server/sqls. but i installed that through the readme instructions and did a lsp-install server sql through emacs.
fwiw i fixed my sqls issue by removing the one emacs installs and installing it myself via npm.
maybe it was happening because my root emacs directory isn't in the stereotypical place or something.
@danielhvs70 what else have you tried besides ejc-sql? Why did you end up there?
thanks again ag, yeah, I can see how that would be useful. Ill defiantly keep it in the back of my mind.
i'm going to play a bit with db beaver, emacs, datagrip and what-ever-intellij does, and see if any of them sparks joy. So far datagrip has the best quick schema uml diagram viewer. All the UI's seem "ok". Overall, it's hard to judge a tool without a problem to hand.
I just use org-mode src blocks like this:
#+begin_src sql :engine postgresql :dbhost localhost :dbport 5003 :database connections :dbuser postgres :dbpassword password
select * from platform_integration_properties where platform_integration_id = 16;
#+end_srcwhat's great about org-mode source blocks that you can "pipe" them one into another. You can run sql, pass it into clojure block (where you can do some data manipulation), then pass the results of that calculation into yet another block, and so on.
@ag if you set up sql-connection-alist, ~/.pgpass you don't need to put the password and other things in the org-mode doc (which may or may not be a security issue for you)
Thanks Ag, yeah, org mode is probably one of the best go-to starting tools around.
Here's a basic example of passing data between org-mode source blocks.
• Fist thing queries the db
• Because it's a named block, the var can be referred by the name in the next one
• The second block takes that tabular data and turns into a json thing
• The third block, using 'jq', formats it nicely
• wrap src json at the last one to push it into a syntax-highlighted json block
I mean this is pure fabrication, if the goal is to get json, you don't need to do all that, because with sqlite you can simply add .mode at the top of the block, like this:
#+begin_src sqlite :db ~/.emacs.d/.local/org-roam.db
.mode json
SELECT * FROM links LIMIT 1;
#+end_src
But let's imagine we're dealing with a different kind of sql db.
what's crazy is that you can even use elisp vars and function results in :vars
like for example in this request where token gets grabbed from an env var:
#+begin_src http :pretty :var token=(shell-command-to-string "echo $MYTOKEN")
GET
Content-Type: application/json
Authorization: Bearer ${token}
#+end_src
The limitation I can think of is if you're returning thousands of rows, of course, in that case, Emacs will struggle to render them - things may get sluggish. But guess what? You can always dump the results into a file, just add :results output file :file ~/foo.json
Hope you find this helpful.