Hi. I'm working on a query that can potentially return thousands of rows. The goal is to write the result into a CSV file. I guess that next.jdbc/plan is the way to go, but I'm not sure what to do with the Reducible that it returns. All the examples that I find (using reduce, transduce, etc) are transforming or aggregating the data. But in my case I just want to write the data to a file and immediately discard it. So I wonder if I'm in the right path. Any hints?
Thanks for the suggestion igrishaev. Already implemented it using next.jdbc/plan, and works like a charm for our use case. But it's good to know there are more options.
If it’s Postgres, you can use CopyManager and redirect any query into a csv tream
Use reduce. The "transform" will write a row to the csv file (and can return nil). You could probably use run!
That uses reduce under the hood.
That sounds good! Thanks