sqltools-bigquery-driver icon indicating copy to clipboard operation
sqltools-bigquery-driver copied to clipboard

Query Cost Estimation with Dry Run

Open archiewood opened this issue 1 year ago • 9 comments

Dry run allows you to see how much data will be processed during your query

archiewood avatar Aug 17 '23 02:08 archiewood

Really good to have BigQuery in VS Code, one of the only things missing for us is the ability to track the potential cost of the query (the dry run stats we would get in the GUI).

ASomerN avatar Sep 26 '23 08:09 ASomerN

Good job with the driver, I agree it would be really useful to see potential cost of the query before running it

juanluisbf avatar Sep 26 '23 08:09 juanluisbf

I'm trying to scope this effort:

src/ls/driver.ts: -Add the dryRunQuery in the BigQueryDriver class

src/extension.ts: -Handle user triggering and output. I'm thinking: https://code.visualstudio.com/api/ux-guidelines/status-bar

vscode.window.setStatusBarMessage(`Dry run: ${result.bytesProcessed} bytes`, 5000);

It will have to be executed using the command palette. At least in this first approach.

Italosayan avatar Nov 30 '23 15:11 Italosayan

I'm thinking: https://code.visualstudio.com/api/ux-guidelines/status-bar

The status bar seems like a pretty sensible place for the output. (It's always visible unlike e.g. the extension sidebar)

It will have to be executed using the command palette.

You could also make the status bar element clickable to execute it I think?

For example, before dry run the status bar could say ► Dry Run Query, and then change to Dry Run: 12.5GB when clicked.

We do a similar thing in the Evidence VSCode extension

CleanShot 2023-11-30 at 12 38 19

archiewood avatar Nov 30 '23 17:11 archiewood

have anyone working on it?

I'm interested in working on this issue, since the scope is clear enough and I really need this feature

banditelol avatar Feb 15 '24 07:02 banditelol

No, you are welcome to it!

archiewood avatar Feb 15 '24 14:02 archiewood

Currently I'm still trying on several alternatives. While I could add new method into the driver.ts, I haven't figured out how to call this method from outside driver.ts (as sqltools seems like loading the files in src/ls/* dynamically).

I have tried importing vscode package to use the messaging part of it, but found this error:

ERROR: Error loading plugin BigQuery Driver for SQLTools Plugin Request ls/RegisterPlugin failed with message: Cannot find module 'vscode'

can you point me to any other resources for the next step?

banditelol avatar Feb 17 '24 04:02 banditelol

I'm afraid I haven't looked into this in detail, so I'm not clear on the best strategy.

I opened this issue on the main SQLtools repo, perhaps you could add some details and tag one of the maintainers?

https://github.com/mtxr/vscode-sqltools/issues/1191

archiewood avatar Apr 01 '24 13:04 archiewood

Currently I'm still trying on several alternatives. While I could add new method into the driver.ts, I haven't figured out how to call this method from outside driver.ts (as sqltools seems like loading the files in src/ls/* dynamically).

I have tried importing vscode package to use the messaging part of it, but found this error:

ERROR: Error loading plugin BigQuery Driver for SQLTools Plugin Request ls/RegisterPlugin failed with message: Cannot find module 'vscode'

can you point me to any other resources for the next step?

Do you have your code available so I can pull it down and look into this error?

vantaboard avatar May 10 '24 14:05 vantaboard