Skip to content

Commit

Permalink
Merge pull request #236 from hkrutzer/fix_missing_written_rows
Browse files Browse the repository at this point in the history
Handle missing written_rows in insert
  • Loading branch information
ruslandoga authored Feb 3, 2025
2 parents 1789543 + c600a85 commit 220b2a2
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 220b2a2

Please sign in to comment.