                      (map (juxt key #(tablet/from-records f (val %))))
                      (map (partial apply store-tablet! store))
                      (into {}))})
-      (partition-approx target-count records))))
+      (partition-approx part-count records))))
 
 
 

;; ## Utilities

(defn- partition-approx
  "Returns a lazy sequence of lists containing the elements of `coll` in order,
  where the average of the list sizes is approximately `target`."
  [target coll]
  ; FIXME: still not as balanced as it could be
  (->>
    [nil 0.0 coll]
    (iterate
      (fn [[_ frac more]]
        (let [length (cond-> (int target) (<= 1.0 frac) inc)]
          [(seq (take length more))
           (- (+ frac target) length)
           (drop length more)])))
    (drop 1)
    (take-while first)
    (map first)))

  (let [records (sort-by first key/compare records)
        limit (or (::limit parameters) 100000)
        families (or (::data/families parameters) {})
        part-count (inc (int (/ (count records) limit)))]
    (map
      (fn make-partition
        [partition-records]
