Feature suggestion: Execute query text within code blocks in markdown
Thank you for this great project! It has been incredibly useful for my workflow.
Would it be useful to allow running queries directly from code blocks in Markdown when the cursor is inside one?
For example
# Analysis Report
Some context about the data.
` ` `sql
SELECT user_id, COUNT(*)
FROM events
WHERE event_type = 'purchase'
GROUP BY user_id;
` ` `
If the cursor is inside the SQL code block and execute run query, the query should be extracted and executed.
I often perform ad-hoc investigations using BigQuery and document findings in Markdown to share on GitHub. It would be much more efficient if I could run queries directly from within the Markdown report.
Would this be a valuable addition? Looking for feedback and thoughts! I can create a PR for this feature if it makes sense.
@cou929
Thanks for using.
If you select some text and BigQuery Runner: Run, you can run a query with the selected text. Can't you achieve what you want to do with that?
I usually follow this workflow: modify query in code block => select query => run query, but it's a bit tedious because I need to take my hands off the keyboard to select the query. So I'd like to run the query without selecting it to make the workflow smoother.
If the extension could parse arbitrary text and run the query around the cursor, it would be a more general solution. But it would be a complex implementation. Extracting the query in a code block is a trivial task in comparison.
Indeed, selecting with the mouse would be troublesome. While we could focus just on markdown files, I also like to solve the issue of executing queries selected from within program files. Here's a different approach: would it help solve your problem if you could run queries from the context menu that appears when you right-click? This would work regardless of file type.
So if I can run a query from the context menu, it's better than selecting a query with the mouse and running it with the keyboard, even though the action of selecting a query remains?
Yes, I agree that the flow is simpler than it is now. However, the action of selecting with the mouse itself is still tedious, since the analytical queries usually I write quickly end up with 50+ or 100+ lines.
Sorry if my understanding is wrong.