 (defn insert-batch-async
   "Same as insert-batch but returns a future"
   [^Session session table records]
-  (let [query (batch-query-from- table records)]
-    (comment
-      (cc/executeasync- session query))))
+  (cc/async
+   (insert-batch session table records)))
 
 (defn atomic-batch
   "Executes a group of operations as an atomic batch (BEGIN BATCH ... APPLY BATCH)"

(defn insert-async
  "Same as insert but returns a future"
  [^Session session & query-params]
  (comment
    (cc/executeasync- session query-params q/insert-query)))

(defn ^:private batch-query-from-
  [table records]
  (->> records
       (map (comp (partial apply (partial q/insert-query table)) flatten vector))
       (apply q/queries)
       ))

(defn insert-batch
  "Performs a batch insert (inserts multiple records into a table at the same time).

(defn delete-async
  "Same as delete but returns a future"
  [^Session session table & query-params]
  (cc/async
   (apply delete session table query-params)))

(defn select
  "Retrieves one or more columns for one or more rows in a table.
