                                   :transformations []})
     (update-successful-job-execution conn {:id job-execution-id})))
 
-(defn failed-import [conn job-execution-id reason table-name]
+(defn- failed-import [conn job-execution-id reason table-name]
   (update-failed-job-execution conn {:id job-execution-id
                                      :reason [reason]})
   (drop-table conn {:table-name table-name}))

            (common/create-dataset-table conn table-name columns)
            (doseq [record (map common/coerce-to-sql (p/records importer))]
              (jdbc/insert! conn table-name record))
            (successful-import conn job-execution-id table-name columns spec claims data-source))))
      (catch Throwable e
        (failed-import conn job-execution-id (.getMessage e) table-name)
        (log/error e)

(hugsql/def-db-fns "akvo/lumen/lib/dataset.sql")
(hugsql/def-db-fns "akvo/lumen/lib/transformation.sql")

(defn- successful-import [conn job-execution-id table-name columns spec claims]
  (let [dataset-id (util/squuid)
        imported-table-name (util/gen-table-name "imported")]
    (insert-dataset conn {:id dataset-id
