Lee-on Pedahzur
Lee-on Pedahzur

Reputation: 71

Programmatically run a query and export it as a CSV file in DataGrip

I am looking to write script in either Python on JavaScript that executes an SQL file query and then saves the results in a CSV file. Bonus points if I can also make it time-bound to run at a specific time.

I have tried looking at the IDE Scripting Console but I can't find any relevant documentation to actually running JavaScript or Python even though it says it's possible.

I'm also open to doing it using the HTTP client and send the query result using a post request.

Anything that can automate the manual labor of clicking through the UI would be hugely appreciated.

Upvotes: 6

Views: 3951

Answers (1)

moscas
moscas

Reputation: 10345

In the IntelliJ-based IDEs there is a functionality called execute to file. Is it what you are looking for?

enter image description here

Upvotes: 5

Related Questions