[Feature Request] Saving SQL Snippets

Hello guys,

I have a trial version of Datagrip, I'm actually using MySQLWorbench as my Database GUI tool.

After giving DataGrip a try, I find if very good, the only missing feature for me is the ability to save custom queries as snippets inside each project and be able to re execute them whenever.

This is very useful when you have to check some data periodically.

More infos here : https://dev.mysql.com/doc/workbench/en/wb-sql-editor-snippets.html




As a temporary solution you can try live templates:

Thank you.


It is a limitation with DG in that is does not have really good project management like other developer products, such as RM. The best that I do is create separate projects for each of my efforts and use multiple scratch files to manage the snippets. That, of course, means keeping all the scratch files open because finding them after they are closed is laborious. It would also be nice to have a scratch file rename feature for files so they can be named something easily recognizable. But that too would be dependent on the folder structure so one could find/recognize them easily.


Just identified my own solution to my own problem. Use RubyMine. It uses the DG internals. It's a bit of sledgehammer, but it does the trick.


Any news on this being implemented? 

Two ways I know of are:

- Saving consoles in the Scratches and Consoles section in Files and naming them as the query, but this feels hacky since the query is allocated to a database/table.

- Another approach currently available is to right click in the Files sidebar and "attach directory" to choose a folder to save .sql files into, which can be opened and then alt-enter to choose a console to run in. 

Could there be another tab next to "Files", which holds agnostic snippets per project or as a predefined subdirectory inside the Files sidebar? This current method feels a little cryptic/hidden. 

It would be nice to see dragging a file from the "Snippets" sidebar/folder into the current console to paste its contents.




@ don v nielsen  & @ Jordan Whitfield 
>> Project management
One can enable classic project management in Settings:

>> Scratches management
You can manage your scratches and Consoles in Files Tool Window: