This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-05-25
Channels
- # announcements (21)
- # babashka (7)
- # beginners (27)
- # calva (7)
- # chlorine-clover (3)
- # cider (1)
- # clerk (21)
- # clojure (24)
- # clojure-europe (28)
- # clojure-finland (3)
- # clojure-nl (1)
- # clojure-norway (5)
- # clojure-uk (2)
- # clojurescript (13)
- # clr (2)
- # conjure (1)
- # consulting (1)
- # datahike (1)
- # datomic (13)
- # fulcro (3)
- # graalvm (33)
- # gratitude (7)
- # honeysql (7)
- # humbleui (12)
- # hyperfiddle (26)
- # interop (11)
- # introduce-yourself (4)
- # jobs-discuss (8)
- # lsp (26)
- # malli (6)
- # nbb (11)
- # polylith (26)
- # practicalli (1)
- # rdf (3)
- # re-frame (7)
- # reitit (10)
- # releases (2)
- # shadow-cljs (1)
- # tools-deps (15)
This is really throwing me for a loop bc I don't think this is invalid SQL...I'm trying to do a batch insert but I get confusing and contradictory errors. If I try to insert just a few records it throws a syntax error, but if I try to insert the whole dataset (just 1000 rows) it says the parameter limit has been exceeded. Here are the basic functions I'm using to work with the data
(defn get-vals
[m ^ObjectMapper mapper]
(-> m
(update :col1 #(.writeValueAsString mapper %))
(update :col2 #(.writeValueAsString mapper %))))
(defn format-query [data]
(-> :table-name
(h/insert-into (h/values (mapv (comp #(get-vals % om)
#(update-keys % keyword)
#(into {} %)) data)))
(hsql/format {:quoted-snake true})))
(defn perform-insert! [data]
(try (sql/query datasource (format-query data))
(catch SQLServerException e
(.. e getSQLServerError getLineNumber))))
and the generated SQL looks like ["INSERT INTO table (col1, col2...) values (?, ?, ...), (?, val1, val2, ...)"]
Just this "Incorrect syntax near ','."
unfortunately
What database?
SQL Server
and this is the other error I get if I try to insert the whole dataset
"The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect. Too many parameters were provided in this RPC request. The maximum is 2100."
Yeah, you need a batch insert to get around that (`next.jdbc/execute-batch!` helps)
👀 2