clerk

2024-07-19T16:37:47.991839Z

how are people here managing database connections in their clerk notebooks (esp during development)

teodorlu 2024-07-19T18:04:59.639319Z

I used Clerk with Playwright (the https://playwright.dev/java/) a few months ago, tried a few things. In the end, I was the most happy with a defonce’d connection, and an out-commented “close and reconnect” alter-var-root right below it.

(defonce conn (playwright ,,,))
#_(alter-var-root #'conn (fn [conn] (.close conn) (playwright ,,,)))
I used the alter-var-root untill I had the thing I wanted in conn, then mostly didn’t touch it after. Other (discarded) approaches felt more heavyweight than useful—especially those who required manual work before the Clerk document “worked”. Also tried a normal def, which caused problems—I had two running instances, when I just wanted one. (I realize that a Playwright instance isn’t the same as database connection, but I’d do the same thing with a PostgreSQL connection).

teodorlu 2024-07-19T18:05:21.448149Z

I hope you share back what you end up with, I’m curious!

➕ 1
teodorlu 2024-07-19T18:08:08.459879Z

More details about my process in a previous thread: https://clojurians.slack.com/archives/C035GRLJEP8/p1705855285929259