Making the query editor (console) execute queries on the currently-highlighted database schema?
I am a user of SQLYog and I'm finding it difficult to adjust to the way DataGrip's query console works.
In SQLYog the query editor pane(s) are not tied to a specific database; so you can enter queries in the query editor and when you run them, they will be run against whatever database is currently highlighted/selected in the database list on the left.
In contrast, it seems like DataGrip requires you to open a specific console window for each database you want to work with. This might sound "safer", but I don't think it is. You could open a query editor for database "LIVE", then select a different database "TEST", check a few things, then click back into the query editor for "LIVE" and accidentally execute queries on your live database even though the "TEST" schema is highlighted/selected in the database list.
Is there a way to make DataGrid execute queries only on the currently-selected database, like SQLYog does?
Please sign in to leave a comment.
For your specific point I recommend you look at setting colors for databases. For example, I have all of my production databases colored red. That makes the query window red as well so there's no mistaking that you're in a production database.
Diamondavocado22, Charles Wise,
What do you have for Switch schema value?
Do you specify your database in data source settings?
Color is a great solution.
But the main is schema chooser per console where you can select context to work with:
vasily chernov Thank you for replying.
My "switch schema" setting is "Automatic" and I have not specified a database in the schema connection settings -- I am connecting to a single MySQL server which contains lots of databases and I need to be able to switch between all of them.
If you haven't already, please use SQLyog for a few minutes and see how the query editor behaves on there when you are switching between multiple different databases. You can use the same query editor (with the same SQL queries) across different databases, depending on the database which is currently highlighted/selected in the schema browser (unless your SQL code explicitly specifies "USE database1;" for example).
That is what I would like to achieve in DataGrip.