Iterating through CSV files


I'm using DataGrip and need to do multiple queries of the following format:

SELECT * FROM table WHERE id = '01345' AND date = '01-01-2020'

For each query, the id and date are different. I have a CSV file with many rows, each row containing a different id and date. Is there a way to get DataGrip to iterate through the CSV file and execute all required queries, and save each output as a CSV file (all outputs combined as a single CSV file would also suffice)?

1 comment
Comment actions Permalink

See StackOverflow answer

There is no one step solution. But here what I would do:

  1. Import CSV file into a table in a temporary in-memory database, e.g. H2
  2. Write your custom extractor, see examples by @moscas

Additionally, see DataGrip blog posts about export and extractors:


Please sign in to leave a comment.