- (defn m-seq
- "a lazy seq of rows from a table. rows are fetched in batches of batch-size, which defaults to 1000"
- ([table] (m-seq 1000 table))
- ([batch-size table]
- (flatten
- (take-while #(> (count %) 0)
- (map (fn [offset] @(-> table
- (cql/drop offset)
- (cql/take batch-size)))
- (iterate (partial + batch-size) 0))))))