Skip to content

Commit

Permalink
Handle missing written_rows in insert
Browse files Browse the repository at this point in the history
  • Loading branch information
hkrutzer committed Feb 3, 2025
1 parent 9f5a7e7 commit c600a85
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/ch/query.ex
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,11 @@ defimpl DBConnection.Query, for: Ch.Query do

num_rows =
if summary = get_header(headers, "x-clickhouse-summary") do
%{"written_rows" => written_rows} = Jason.decode!(summary)
String.to_integer(written_rows)
summary = Jason.decode!(summary)

if written_rows = Map.get(summary, "written_rows") do
String.to_integer(written_rows)
end
end

%Result{num_rows: num_rows, rows: nil, command: :insert, headers: headers}
Expand Down

0 comments on commit c600a85

Please sign in to comment.