feat(sqllab): Allow running query without highlighting the code#27314
feat(sqllab): Allow running query without highlighting the code#27314soniagtm wants to merge 1 commit into
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #27314 +/- ##
==========================================
+ Coverage 67.37% 67.39% +0.02%
==========================================
Files 1908 1908
Lines 74550 74609 +59
Branches 8317 8317
==========================================
+ Hits 50225 50284 +59
Misses 22272 22272
Partials 2053 2053
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
|
@soniagtm Thank you for your suggestion. I appreciate your input, but I do have a few reservations regarding these changes. Firstly, this modification will alter the behavior of the "Run" command. Users who employ multiple SQLs in a single run might experience some regression due to this change. Secondly, investigating the query AST on the client side could potentially lead to critical bugs because it might execute unexpected SQL commands. To mitigate this risk, we should consider using a more stable solution like sqlglot, which is managed on the backend side. Lastly, I have already introduced a similar feature that runs the current query using a shortcut(ctrl + shift + enter #24329). This means users wishing to run a query without highlighting can achieve the same results using this shortcut. Thanks, |
|
Hi @justinpark, Thank you for sharing your thoughts and concerns. Considering your reservations, I completely understand the importance of maintaining the current functionality and user experience. Regarding the existing feature for running current query, it would indeed be beneficial if it could support executing queries without relying solely on semicolons, as is commonly seen in other tools. Additionally, it would be helpful to address cases where semicolons are part of the query. Perhaps these could be explored as potential areas for improvement in the future. Thank you once again for your feedback. I'll close this PR. |
SUMMARY
When a user enters multiple queries in one tab and wants to execute each of them, they would have to highlight the SQL they want to execute (in previous versions), which would not be ideal for extremely long queries. To solve this problem, I created the getCurrentQuery function to allow executing each query without the need to highlight the specific query they wish to run. Instead, users can place the cursor at the intended query and press the RUN button.
It's important to note that queries must be separated by either at least one blank line or a semicolon, and no blank lines are allowed within the same query. When the cursor is placed at the blank lines between two queries, the upper query will be executed. This also handles the case when a semicolon is part of the query.
This function was actually created a long time ago, and I found that in newer versions, there already exists a shortcut key to execute the current query. I wanted to share this implementation in case it might be useful or maybe created as another shortcut key.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Before
Screen.Recording.2567-03-01.at.10.11.04.mov
After
Screen.Recording.2567-03-01.at.10.15.23.mov
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION