Fork me on GitHub
#sql
<
2017-04-07
>
josh.freckleton19:04:29

Does this batch insert in YeSQL? (insert-stuff<! [{:name "joe"} {:name "sally"} ...])

josh.freckleton19:04:47

or rather, is that the proper way to batch insert in YeSQL?

josh.freckleton19:04:47

by feeding the fn a vector of maps, instead of just maps

josh.freckleton19:04:17

Hm, i think not, is there a way to batch insert with YeSQL?

tanzoniteblack20:04:41

@josh.freckleton there are 2 open yesql PR's about batch insert (https://github.com/krisajenkins/yesql/pull/145 & https://github.com/krisajenkins/yesql/pull/135)...neither have been merged in or released...

tanzoniteblack20:04:03

nowadays, I generally just recommend people use jdbc directly with honeysql (https://github.com/jkk/honeysql), which would allow you to compose an efficient insert into statement without much fuss

josh.freckleton21:04:15

@tanzoniteblack thanks for the recommendation, I've been playnig with honeysql for the past hour, and, well it works great for generating a batch insert

josh.freckleton21:04:27

I can't quite solve upserts tho

josh.freckleton21:04:39

like REPLACE, or INSERT ON DUPLICATE KEY UPDATE

tanzoniteblack21:04:34

@josh.freckleton which DB are you using? on duplicate key update is mysql, right?

josh.freckleton21:04:44

sorry, yes it is

tanzoniteblack21:04:54

I know for postgres, there's a honeysql extension (https://github.com/nilenso/honeysql-postgres) that supports postgres's specific on conflict insert command

tanzoniteblack21:04:13

but don't have any experience doing a similar thing with mysql

josh.freckleton21:04:13

thanks for the recommendation. this shouldn't be so hard, but I guess that's what you get when you've been cranking all day and its a friday 😉