        (try
          (let [{:keys [table-name imported-table-name
                        importer-columns imported-dataset-columns
-                       latest-dataset-version]} (import-data-to-table tenant-conn
+                       latest-dataset-version]}  (import-data-to-table tenant-conn
                                                                        caddisfly
                                                                        import-config
                                                                        dataset-id

  pointing to the new table-name, imported-table-name and columns. We
  also delete the previous table-name and imported-table-name so we
  don't accumulate unused datasets on each update."
  [conn job-execution-id dataset-id table-name imported-table-name dataset-version]
  (db.transformation/touch-dataset conn {:id dataset-id})
  (db.transformation/drop-table conn {:table-name (:imported-table-name dataset-version)})
  (db.transformation/drop-table conn {:table-name (:table-name dataset-version)})
  (db.job-execution/update-successful-job-execution conn {:id job-execution-id}))

(defn- failed-update [conn job-execution-id reason]
  (db.job-execution/update-failed-job-execution conn {:id job-execution-id

                                                                                                table-name
                                                                                                importer-columns
                                                                                                imported-dataset-columns)]
           (successful-update tenant-conn job-execution-id dataset-id table-name imported-table-name latest-dataset-version columns transformations))
         (catch Exception e
           (failed-update tenant-conn job-execution-id (.getMessage e))
           (p/track error-tracker e)
