Different buttons for "Execute Script", "Execute Query", and "Execute Selected"

Currently in the Redash editor, if you highlight some text, the “Execute” button changes to an “Execute Selected” button. This is great, but if you have many queries in a script that you are constantly switching between, some of which may be quite lengthy, it’s very tedious to highlight an entire query every time you want to execute it independently of the rest of the script.

I suggest detecting the number of queries present in the editor and if there is more than one, then show two buttons, “Execute Script” and “Execute Query”. If the user clicks “Execute Query” then execute only the query where the cursor is currently located. Queries should be delimited by “;” which can be used to determine the presence of multiple queries and which one the cursor is in.

The “Execute Selected” feature is still needed because sometimes you don’t want to execute a whole query but rather a nested subquery that isn’t delimited by “;”. If you have multiple queries in your script, and you highlight something, I’d prefer to see all 3 buttons: “Execute Script”, “Execute Query”, and “Execute Selected”. Alternatively you could replace the “Execute Script” and “Execute Query” buttons with a single “Execute Selected” button.

My database tool of choice, dBeaver, has this feature and I use it constantly. It’s one of the few things I miss in Redash.