           imported-table-name (gen-table-name "imported")
           imported-columns (:columns (imported-dataset-columns-by-dataset-id conn
                                                                              {:dataset-id dataset-id}))
-          {:keys [transformations]} (latest-dataset-version-by-dataset-id conn {:dataset-id dataset-id})]
+          {:keys [transformations] :as dataset-version} (latest-dataset-version-by-dataset-id
+                                                         conn {:dataset-id dataset-id})]
       (with-open [importer (import/dataset-importer (get data-source-spec "source") config)]
         (let [columns (import/columns importer)]
           (if-not (compatible-columns? imported-columns columns)

                                   job-execution-id
                                   dataset-id
                                   table-name
                                   imported-table-name))))))
    (catch clojure.lang.ExceptionInfo e
      (failed-update conn job-execution-id (.getMessage e))
      (throw e))

    (java.sql.Timestamp. (.toEpochMilli value))))

(defn coerce-to-sql [record]
  (reduce-kv
   (fn [result k v]
     (assoc result k (when v (coerce v))))
