Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running the contributed command: 'sqltools.saveResults' failed. #849

Closed
1 of 5 tasks
deejcunningham opened this issue Aug 6, 2021 · 3 comments
Closed
1 of 5 tasks
Labels

Comments

@deejcunningham
Copy link

Describe the bug
When trying to save results as CSV or JSON, I the the error:

Running the contributed command: 'sqltools.saveResults' failed.

I am also unable to open results as either CSV or JSON with the following error:

Running the contributed command: 'sqltools.openResults' failed.

To Reproduce
Steps to reproduce the behavior:

  1. Make a query that returns some results.
  2. Click on the Save Results (or Open Results) button in the top right of the results tab.
  3. Choose either CSV or JSON.
  4. Click save on the save file window that appears. (or do nothing if opening results)
  5. Receive error.

Expected behavior
I expect the results to save to a file, or to open in a new VSCode tab.

Screenshots
image

Desktop (please complete the following information):

  • SQLTools Version: v0.23.0
  • VSCode Version: 1.58.0
  • OS: Arch Linux x86_64 Kernel 5.13.6-arch1-1
  • Driver:
    • PostgreSQL/Redshift
    • MySQL/MariaDB
    • MSSQL/Azure
    • SQLite
    • Other? Which...
  • Database version: Microsoft SQL Server 2017 (RTM-CU19) (KB4535007) - 14.0.3281.6 (X64)
    Jan 23 2020 21:00:04
    Copyright (C) 2017 Microsoft Corporation
    Web Edition (64-bit) on Windows Server 2016 Datacenter 10.0 (Build 14393: ) (Hypervisor)

Additional context
Some possibly helpful logs from /home/david/.config/Code - OSS/logs/20210806T091010/exthost5/exthost.log:

[2021-08-06 15:13:41.546] [exthost] [error] Error: Request connection/SaveResultsRequest failed with message: Cannot destructure property 'results' of '(intermediate value)' as it is undefined.
        at /home/dj/.vscode-oss/extensions/mtxr.sqltools-0.23.0/dist/extension.js:16:111820
        at /home/dj/.vscode-oss/extensions/mtxr.sqltools-0.23.0/dist/extension.js:16:112227
        at Immediate.<anonymous> (/home/dj/.vscode-oss/extensions/mtxr.sqltools-0.23.0/dist/extension.js:16:112769)
        at processImmediate (internal/timers.js:461:21) sqltools.saveResults
[2021-08-06 15:19:46.134] [exthost] [error] Error: Request connection/SaveResultsRequest failed with message: Cannot destructure property 'results' of '(intermediate value)' as it is undefined.
        at /home/dj/.vscode-oss/extensions/mtxr.sqltools-0.23.0/dist/extension.js:16:111820
        at /home/dj/.vscode-oss/extensions/mtxr.sqltools-0.23.0/dist/extension.js:16:112227
        at Immediate.<anonymous> (/home/dj/.vscode-oss/extensions/mtxr.sqltools-0.23.0/dist/extension.js:16:112769)
        at processImmediate (internal/timers.js:461:21) sqltools.openResults
@deejcunningham
Copy link
Author

Further fiddling indicates that this actually only fails sometimes. Will need further fiddling to understand exactly what differentiates failure from success.

@deejcunningham
Copy link
Author

Results of fiddling. Seems like multiple connections throws off the saving/opening, specifically when the results being saved/opened are not from the most recent connection.

Success:

  1. Open new, single connection.
  2. Run single query.
  3. Click Open or Save on results.
  4. Success ✔️

Failure:

  1. Open new connection (MSSQL).
  2. Run query on this first connection.
  3. Receive results in new tab.
  4. Open second connection (postgres in my case), do not run a query or close first connection (second connection is active connection).
  5. Go back to results tab from from first query from first connection.
  6. Click Save or Open
  7. Fail ❌
    (This also fails when first and second connections are to distinct MSSQL servers)

Success:

  1. Open new connection (postgres). Do not run query.
  2. Open second connection (MSSQL). Do not close first connection, but second connection is active)
  3. Run query and receive results
  4. Click Open/Save
  5. Success ✔️
    (Also succeeds when first and second connections are distinct MSSQL servers)

Failure:

  1. Open first connection.
  2. Run query and receive results
  3. Open second connection. (do not close first)
  4. Do not run query or do anything on second connection.
  5. Switch back to first connection being active. (do not close second connection)
  6. Go to results tab (from first connection) and hit Save/Open
  7. Failure ❌

@deejcunningham
Copy link
Author

I have this reliably working based on my earlier comment so I will close this issue.

TL;DR: Only open a single connection at a time, run your query, then open/save your results before opening or switching to any other connections.

Hopefully this helps somebody in the future :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant