Fork me on GitHub
#announcements
<
2022-11-04
>
nonrecursive14:11:32

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/

🆒 6
👏 12
1
👀 5
1
1
🙌 6
👍 33
❤️ 6
🎉 19
1
21
2
🕶️ 3
Noah Bogart15:11:45

yooooooooo this is sick

🙏 1
Noah Bogart15:11:28

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)

nonrecursive15:11:17

yes! That’s something I miss from rails too. I really like that idea

Noah Bogart15:11:55

Is it possible to use clojure.java.jdbc? We've not begun switching over yet

borkdude15:11:52

you can use both side by side without having conflicts AFAIK

nonrecursive15:11:04

hmm yeah xray could take an optional second argument, an adapter config that’s merged with the default

metal 2
nonrecursive16:11:07

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

metal 1
dharrigan16:11:00

amazing work!

kennytilton16:11:15

Love the name!

2
seancorfield16:11:45

> 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.

👍 1
tolitius17:11:09

@U0AQ1R7FG yep, https://clojurians.slack.com/archives/C06MAR553/p1667576944769159?thread_ts=1667573312.021829&amp;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

nonrecursive18:11:32

whoops thanks, good catch!

richiardiandrea19:11:34

woooo man this is awesome!

nonrecursive20:11:05

😊 thanks! @mpoffald helped me with it. I hope it’ll be useful for people!

❤️ 1
Ben Sless20:11:27

So cool! One of the things which was on my list of "when I get to it or get angry enough" Thank you!

❤️ 1
Ben Sless20:11:26

Tiny suggestion regarding malli schema: emit a registry and not def forms?

nonrecursive20:11:18

hmm what do you think of having both? generate-defs generate-registry

Ben Sless20:11:22

I certainly see no reason to object 🙃

Ben Sless20:11:12

Now imagine plugging this in to clerk, portal, etc 👀

😮 1
Ben Sless20:11:56

You made a db explorer, buddy. Or at least the building blocks for one. Congrats 🙂

🙏 2
Ben Sless20:11:26

You can also write a db client. A desktop client. With membrane!

nonrecursive21:11:16

I think that would be super dope!

alexyakushev18:11:32

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/

🎉 46
6
nonrecursive21:11:42

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

🥔 26
💯 10
gratitude 4
nonrecursive21:11:22

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

clojure-spin 3
Ben Sless05:11:14

Really went looking for a "Because I'm a potato" quote in the readme 😄

😅 1
🥔 1