This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-12-15
Channels
- # adventofcode (80)
- # beginners (94)
- # biff (19)
- # cider (74)
- # clj-kondo (11)
- # cljs-dev (7)
- # clojure (110)
- # clojure-austin (3)
- # clojure-australia (1)
- # clojure-belgium (1)
- # clojure-china (1)
- # clojure-europe (83)
- # clojure-filipino (1)
- # clojure-hk (1)
- # clojure-indonesia (1)
- # clojure-japan (1)
- # clojure-korea (1)
- # clojure-my (1)
- # clojure-nl (1)
- # clojure-norway (4)
- # clojure-sg (1)
- # clojure-taiwan (1)
- # clojure-uk (2)
- # cursive (3)
- # data-science (8)
- # datalevin (8)
- # emacs (18)
- # etaoin (5)
- # graalvm (1)
- # holy-lambda (3)
- # honeysql (1)
- # jackdaw (10)
- # java (10)
- # jobs (3)
- # luminus (9)
- # malli (106)
- # off-topic (88)
- # polylith (8)
- # portal (2)
- # re-frame (50)
- # reagent (11)
- # reitit (74)
- # remote-jobs (1)
- # shadow-cljs (46)
- # tools-deps (26)
- # xtdb (49)
Hi folks! Quick conman question -- I'm using conman & hugsql in my app, and they work beautifully. It would be really nice, when calling a DB query bound with bind-connection
to be able to see the actual SQL query sent to the DB (eg for debugging). Anyone aware of a way to do that? Have been looking at the conman docs & I feel like it must be there but I'm somehow missing it.
Would you like to get the exact statement via a function in the REPL, or would logging be enough?
Logging would be plenty! (Sorry, missed the notification of your response yesterday)
I’m pretty convinced we had that activated in one of our apps. I have to check (and maybe search in the Git history). Hope I can come back to you soon
So, it took longer than I expected, sorry for that. I am not able to find the code anymore, but I’m pretty sure that we hooked into the JDBC driver for logging.
How easy it is unfortunately depends on the type of driver
Finally got around to digging into this again. For future reference & in case useful to others -- you can do this at the next.jdbc level (assuming you're using next.jdbc; other adapters may have equivalents). eg here I'm wrapping the conman/connect!
call to cause all params to be logged:
(next.jdbc/with-logging
(conman/connect! {:jdbc-url jdbc-url})
(fn [op params] (prn "SQL operation " op "::" params)))
You can also pass a second function to log results.
https://cljdoc.org/d/com.github.seancorfield/next.jdbc/1.2.761/api/next.jdbc?q=logging#with-logging