This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-11-04
Channels
- # announcements (30)
- # aws (7)
- # babashka (7)
- # beginners (64)
- # calva (39)
- # cherry (17)
- # cider (1)
- # clj-on-windows (6)
- # clojure (30)
- # clojure-austin (12)
- # clojure-europe (25)
- # clojure-nl (2)
- # clojure-norway (23)
- # clojure-spec (23)
- # clojure-uk (6)
- # clojurescript (20)
- # cursive (18)
- # datahike (3)
- # datalevin (12)
- # datomic (9)
- # etaoin (5)
- # graalvm (45)
- # instaparse (2)
- # interceptors (11)
- # kaocha (1)
- # lsp (102)
- # meander (6)
- # nbb (16)
- # off-topic (30)
- # pathom (83)
- # pedestal (6)
- # portal (5)
- # re-frame (12)
- # reitit (5)
- # rewrite-clj (10)
- # scittle (35)
- # shadow-cljs (49)
- # spacemacs (10)
- # vim (14)
First release of https://github.com/donut-party/dbxray - get metadata for JDBC dbs and use that to generate basic specs or schemas. Huge thanks to @seancorfield for next-jdbc, which this relies on, and whose source code helped me figure out how to work with jdbc. Also thanks to @mpoffald for contributing and helping me think it through. I’m going to be demoing this https://www.meetup.com/london-clojurians/events/288750683/
One of my favorite parts of rails is schema.rb
which acts as a canonical in-code representation of the database, which makes checking "how is this all connected?" as simple as reading a single file (instead of sending multiple queries in a database repl and figuring it out yourself). This pretty neatly solves that problem if you use a wrapper around a migration library (like migratus)
yes! That’s something I miss from rails too. I really like that idea
Is it possible to use clojure.java.jdbc? We've not begun switching over yet
That's true
@U0AQ1R7FG noice! would be great to be able to https://github.com/donut-party/dbxray/blob/1d84500c9693ab806414128905aae844614675dd/src/donut/dbxray.clj#L31 a schema name
hmm yeah xray
could take an optional second argument, an adapter config that’s merged with the default

@U0541KMAZ ok I threw that in without really checking it but I think it should work 😅

> Is it possible to use clojure.java.jdbc? We've not begun switching over yet
We have both in our codebase at work. We create a HikariCP connection pooled datasource from our db-spec hash map at startup and then pass {:datasource cpd}
around our code as db-spec
. That works as-is with c.j.j and, since next.jdbc
1.2.790, that also works as-is so it's easy to use the two together while you migrate. Prior to that, when we called next.jdbc
we passed (:datasource db-spec)
.
Just bear in mind that c.j.j's default is rs/as-unqualified-lower-maps
in next.jdbc
unless you also change the code to handle the results (which we mostly did not do). So you can easily switch one call at a time.
@U0AQ1R7FG yep, https://clojurians.slack.com/archives/C06MAR553/p1667576944769159?thread_ts=1667573312.021829&cid=C06MAR553 to create the schema! https://github.com/donut-party/dbxray/blob/a3bd2cb391e040ed0d5d51d0374d387d26a8aef1/src/donut/dbxray/generate/malli.cljc#L18 might need to only take the “`table-name`” once though?
=> (csk/->PascalCaseSymbol :foo)
Foo
=> (csk/->PascalCaseSymbol :foo :foo)
Execution error
No value supplied for key: :foo
whoops thanks, good catch!
thank you @U11EL3P9U and @U0PUGPSFR 🙂
woooo man this is awesome!
So cool! One of the things which was on my list of "when I get to it or get angry enough" Thank you!
hmm what do you think of having both? generate-defs
generate-registry
You made a db explorer, buddy. Or at least the building blocks for one. Congrats 🙂
I think that would be super dope!
Clojure Goes Fast has kickstarted its new shiny knowledge base with detailed documentation on clj-async-profiler. Basically, everything from the blog posts got restructured, edited, and revitalized, and some fresh guides were added. http://clojure-goes-fast.com/kb/profiling/clj-async-profiler/
First* release of https://github.com/donut-party/datapotato, a library for handling database fixtures for tests! It’s great for making tests clearer, more concise, and easier to maintain, and it has integrations for next-jdbc, XTDB, and datomic. *datapotato is a fork of https://github.com/reifyhealth/specmonstah and should be 100% backwards-compatible (you should only need to change your namespace requires). datapotato provides better interfaces for the intended use case, and it should be easier to get productive with it

You can use https://github.com/donut-party/dbxray to help you get started with datapotato - dbxray can generate the clojure specs / malli schemas you need to generate data, plus the “potato schema” datapotato needs to handle entity hierarchies
