Fork me on GitHub
#sql
<
2017-08-22
>
plins22:08:43

hello everyone, is there any recommendation while using core.async in conjunction with clojure.jdbc ? or i should wrap the queries with core.async/thread and i’m good to go?

noisesmith22:08:17

that’s the best plan, yes just return the data from thread and read the channel in your go block to get it

noisesmith22:08:51

sadly we don’t have good async support in jdbc or else there might be a nicer option (iirc this is an upstream java issue and not a clojure one)

seancorfield22:08:03

With the latest clojure.java.jdbc (0.7.0) you have reducible-query so it should play nice with transducers on channels if that's any help...

seancorfield22:08:44

(I don't do much with core.async yet but I'm expecting that to change at some point)

noisesmith22:08:13

would that mean you’re attaching IO to a channel via its transducer?

noisesmith22:08:29

anyway, that’s what it seems like, and that could be OK as long as you manage the channel properly so that you aren’t accessing it from go blocks

seancorfield22:08:30

Hmm, I thought there was something about transducers that would let you connect a (reducible) collection as input to a channel as output, but I don't see anything obvious...

noisesmith22:08:38

you can attach a transducer to a channel, but I don’t think you can do the inverse

seancorfield23:08:39

Yeah, I was thinking you could transduce a collection into a channel but it looks like you can create a channel with an attached transducer and then you have to use onto-chan to get a collection into it... and that doesn't care about a reducible collection.