5

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.

1 Answers1

3

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

enter image description here

moscas
  • 9,064
  • 36
  • 42
  • Thanks for answering! No, I'm looking for something that will both run a query and save it but with out me needing to click through menus in the UI. I'm looking to build a script that essentially automates UI clicks. – Lee-on Pedahzur Aug 07 '20 at 16:13
  • So, you have your SQL in the query console of DataGrip. You want to PRESS MAGIC BUTTON and with no other UI interactions, you want the CSV file to be created. Am I right? – moscas Aug 10 '20 at 09:58
  • 3
    I have a few SQL files saved in a folder, I want DG to open each, run them and then save each to a CSV file with one press of a Magic Button. I know that you can run scripts in DG, but it seems like it's so complex/unclearly documented, no one is actually doing it. – Lee-on Pedahzur Aug 11 '20 at 11:45