Hello all, The issue I am facing goes like this →
My objective is to write data into csv file with already some existing data in it without affecting the current data. I am basically writing into csv in batches. Earlier if I have to write data simple into an empty csv file I was doing this →
NimbleCSV.define(MyParser, separator: ",", escape: "\"")
defmodule Script do
alias NimbleCSV.RFC4180, as: CSV
@bom :unicode.encoding_to_bom({:utf16, :little})
@query_size 5_000
def write_csv_file(data) do
File.write!("data_write.csv", [@bom, data_to_csv(data)])
end
def data_to_csv(data) do
data |> Enum.count |> IO.inspect()
data
|> MyParser.dump_to_iodata()
|> :unicode.characters_to_binary(:utf8, {:utf16, :little})
end
end
any ideas on how I should write to csv in batches?