I have a sql file saved off that I want to open and get results back from a database I am connected to in DataGrip. When I open the file, it opens it up as a file scope, and not as a console scope, and I cannot run the sql against the database. I have to open up a new database console, copy my SQL into the database console, and run it from there. Make any changes I want to the SQL, and save it back to the file. I just want to open the file up as a console.
I have to be doing this wrong. What am I missing? How can I open a SQL file from disk in DataGrip and execute the query in a console-like fashion?
Example: I have a SQL file: "customer.sql" that contains "Select top 10 * from customer". When I open up "customer.sql", it opens up as a file in DataGrip with no execution or associated database relationship. I want to run the "customer.sql" contents of "select top 10 * from customer" against one of my database connections. Make my changes to the query "select top 11 * from customer" and save it back to "customer.sql"