Merging Rows and Columns from Query

Receiving the follows struct from the a query and I want to merge the rows and columns where the column is the KEY and row data eg %{key: data}

{:ok,
 %Tds.Result{
   columns: ["id", "fitness_license", "license_plate", "uid", "engine_type",
    "model", "make", "year", "color", "state_of_registration", "vin_number",
    "serial_number", "hull_number", "operator_id", "vehicle_class", "company",
    "company_info", "vehicle_capacity", "driver", "transport_officer", "status",
    "auth_status", "maker_id", "checker_id", "maker_date_time",
    "checker_date_time", "user_description", "system_description", "created_at",
    "updated_at"],
   num_rows: 1,
   rows: [
     [2, "yes", "ABY 1234", "6789", "K9", "M998", "China", "2018", "Black",
      "Yes", "7689", "hjkl5678", "y7yjj8", "1", "C1", "Viper Cars",
      "Sells cars", "89", "Peter", "Twaambo", nil, false, 1, 4,
      ~N[2020-09-13 06:55:11.000], ~N[2020-09-13 06:55:14.000], "I want to try",
      "IP ADDRESS", ~N[2020-09-13 06:55:51.000], ~N[2020-09-13 06:55:54.000]]
   ]
 }}

Roughly:

{:ok, %{columns: columns, rows: rows}} = the_fun_call_creating_the_data()

Enum.map(rows, fn row ->
  rows
  |> Enum.zip(column)
  |> Map.new()
end)

This is untested and smartphone written, typos or other weird “corrections” might have happened.

Its mapping all the rows to one column

[
%{
[2, “yes”, “ABY 1234”, “6789”, “K9”, “M998”, “China”, “2018”, “Black”,
“Yes”, “7689”, “hjkl5678”, “y7yjj8”, “1”, “C1”, “Viper Cars”, “Sells cars”,
“89”, “Peter”, “Twaambo”, nil, false, 1, 4, ~N[2020-09-13 06:55:11.000],
~N[2020-09-13 06:55:14.000], “I want to try”, “IP ADDRESS”,
~N[2020-09-13 06:55:51.000], ~N[2020-09-13 06:55:54.000]] => “id”
}
]

Yeah, seems as if I have the arguments to zip in the wrong order.

Enum.map(rows, fn row ->
  columns
  |> Enum.zip(row)
  |> Map.new()
end)

Thanks a lot for your help, I had real problems with that