Inserting CSV into postgres

Yea, if I need one second for each individual row to insert, it would take hours to complete..
So, as for the link provided, how would I refactor their example below, so that it will be feeded by the CSV.decode in my code above?

Postgrex.transaction(pid, fn(conn) →
query = Postgrex.prepare!(conn, “”, “COPY users TO STDOUT;”)
Postgrex.stream(conn, query, )
|> Enum.into(File.stream!(“users”), fn(%Postgrex.Result{rows: rows}) → rows end)
end)

But, then, I will lose validation as you mentioned? any work arround for possible errors to handle?

Thanks for valuable help!