                                    :to-table imported-table-name}
                                   {}
                                   {:transaction? false})
-                (apply-transformation-log conn table-name imported-columns transformations)
-                (successful-update conn
-                                   job-execution-id
-                                   dataset-id
-                                   table-name
-                                   imported-table-name
-                                   dataset-version))))))
+                (let [new-columns (apply-transformation-log conn
+                                                            table-name
+                                                            (mapv (fn [{:keys [title id type]}]
+                                                                    {"type" (name type)
+                                                                     "title" title
+                                                                     "columnName" (name id)
+                                                                     "sort" nil
+                                                                     "direction" nil
+                                                                     "hidden" false})
+                                                                  columns)
+                                                            transformations)]
+                  (successful-update conn
+                                     job-execution-id
+                                     dataset-id
+                                     table-name
+                                     imported-table-name
+                                     dataset-version
+                                     new-columns)))))))
     (catch clojure.lang.ExceptionInfo e
       (failed-update conn job-execution-id (.getMessage e))
       (throw e))

      columns)))

(defn compatible-columns? [imported-columns columns]
  (let [imported-columns (reduce (fn [m column]
                                   (let [column-id (keyword (get column "columnName"))
                                         column-type (keyword (get column "type"))
                                         column-title (get column "title")]
                                     (assoc m column-id {:id column-id
                                                         :type column-type
                                                         :title column-title})))
                                 {}
                                 imported-columns)]
    (every? (fn [column]
              (= column (get imported-columns (:id column))))
            columns)))

(defn do-update [conn config dataset-id data-source-id job-execution-id data-source-spec]
  (try

            [clj-http.client :as client]
            [clojure.data.csv :as csv]
            [clojure.java.jdbc :as jdbc]
            [clojure.set :as set]
            [clojure.string :as str]
            [hugsql.core :as hugsql]))

