azuredatastudio icon indicating copy to clipboard operation
azuredatastudio copied to clipboard

Azure Data Studio fails to save to Excel/csv for medium to large size data sets

Open johncquayle opened this issue 2 years ago • 11 comments

  • Azure Data Studio Version: 1.39.0
  • OS Version: Windows 10 Enterprise Version 1809 Build 17763.1879
  • Version: 1.39.0 (system setup) Commit: 9fdb2161d49b4d4ab6798809faa042a898ca2eae Date: 2022-08-20T01:46:47.606Z VS Code: 1.62.0 Electron: 13.6.6 Chrome: 91.0.4472.164 Node.js: 14.16.0 V8: 9.1.269.39-electron.0 OS: Windows_NT x64 10.0.17763

Issue Type: Bug

  1. Execute query that returns >~100000 rows of results.
  2. Right click and save 'Save as Excel' or 'Save as CSV'.
  3. The 'Saving File' dialog will appear.
  4. The operation will never complete - the 'Saving File' dialog will remain until you close and reopen Azure Data Studio. Expected result is 'Successfully Saved Results to...' Dialog
  5. The output file gets created but remains empty, expected functionality is that the file would be populated with data.
  6. N.B. The same data set can be extracted by using SSMS 'Results to File' option but it's a nuisance to have to use SSMS for this.

Azure Data Studio version: azuredatastudio 1.39.0 (9fdb2161d49b4d4ab6798809faa042a898ca2eae, 2022-08-20T01:46:47.606Z) OS version: Windows_NT x64 10.0.17763 Restricted Mode: No

System Info
Item Value
CPUs Intel(R) Core(TM) i5-8365U CPU @ 1.60GHz (8 x 1896)
GPU Status 2d_canvas: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
skia_renderer: enabled_on
video_decode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 7.81GB (1.36GB free)
Process Argv
Screen Reader no
VM 0%
Extensions (15)
Extension Author (truncated) Version
demo-mode dre 1.1.0
query-editor-boost dre 0.4.1
sql-data-inspector ern 0.4.0
azuredatastudio-select-top-n jim 0.0.5
azuredatastudio-postgresql Mic 0.2.7
import Mic 1.5.0
query-history Mic 0.2.1
server-report Mic 0.2.3
extra-sql-script-as pac 0.4.1
sqlops-spexecutesql-to-sql pej 1.0.1
schema-visualization R0t 0.7.1
sql-prompt Red 0.2.11
sql-search Red 0.4.0
simple-data-scripter sea 0.1.6
vscodeintellicode Vis 1.2.1

Does this issue occur when all extensions are disabled?: Yes/No

johncquayle avatar Aug 24 '22 20:08 johncquayle

@johncquayle how long did you wait before you restart Azure Data Studio?

alanrenmsft avatar Aug 29 '22 15:08 alanrenmsft

We need more info to debug your particular issue. If you could attach your logs to the issue (ensure no private data is in them), it would help us fix the issue much faster. First open the Settings page, find the Mssql: Tracing Level setting and change that to All then restart ADS and repro your issue. Next there are two types of logs to collect:

Console Logs

  • Open Developer Tools (Help -> Toggle Developer Tools)
  • Click the Console tab
  • Click in the log area and select all text (CTRL+A)
  • Save this text into a file named console.log and attach it to this issue.

Application Logs

  • Open command palette (Click View -> Command Palette)
  • Run the command: Developer: Open Logs Folder
  • This will open the log folder locally. Please zip up this folder and attach it to the issue.

github-actions[bot] avatar Aug 29 '22 15:08 github-actions[bot]

I have left it overnight and it is still spinning in the morning.

SSMS would return the same data set into a CSV within an hour.

Thanks, John

On Tue, 30 Aug 2022 at 03:46, Alan Ren @.***> wrote:

@johncquayle https://github.com/johncquayle how long did you wait before you restart Azure Data Studio?

— Reply to this email directly, view it on GitHub https://github.com/microsoft/azuredatastudio/issues/20463#issuecomment-1230496719, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIAXQXLPRVD77ID55LN7NGTV3TLNPANCNFSM57QW4NJQ . You are receiving this because you were mentioned.Message ID: @.***>

johncquayle avatar Aug 29 '22 21:08 johncquayle

This might be related to the PostgreSQL extension. I'm experiencing this issue very very often (virtually always) with one particular script I run monthly on a PostgreSQL server, even though saving results as xlsx usually works just fine for other queries I run on that same server.

For a test, I transferred my data from PG to Sql Server, disabled the postgresql extension and adjusted the problematic script to run on Sql Server (and return the exact same results as from PG). I've ran the test script several times with different parameters and successfully saved the results to an excel file every time. Re-enabling the PG extension does not seem to have any influence on saving results from the test script.

When the problem occurs, the created XLSX file is empty, as in 0 bytes empty, it's not a valid Excel file.

Running on: Version: 1.40.2 (user setup) Commit: 661384637db384fe5d4e6224069adbe708580b16 Date: 2022-12-22T22:17:02.658Z VS Code: 1.67.0 Electron: 17.4.11 Chromium: 98.0.4758.141 Node.js: 16.13.0 V8: 9.8.177.14-electron.0 OS: Windows_NT x64 10.0.19045

System info: Processor Intel(R) Core(TM) i7-8665U CPU @ 1.90GHz 2.11 GHz Installed RAM 24,0 GB (23,8 GB usable) System type 64-bit operating system, x64-based processor

I've manually installed only the azuredatastudio-postgresql extension.

marko-p avatar Jan 06 '23 11:01 marko-p

I forgot to mention - I'm having problems even when trying to save small data sets (for example 133 records with 29 columns).

marko-p avatar Jan 06 '23 12:01 marko-p

Has this been confirmed as being a problem with the Postgresql extension?

I often have problems saving output from MSSQL queries, not Postgresql, but it's not practical for me to restart Azure Data Studio every time I want to turn on the Postgresql extension.

johncquayle avatar Mar 07 '23 19:03 johncquayle

ok, I'll take a look.

alanrenmsft avatar Mar 10 '23 02:03 alanrenmsft

Confirmed that this is still a problem, even with the Postgresql extension disabled

johncquayle avatar Jun 08 '23 23:06 johncquayle

The only workaround I've found, which is a real pain, is to run the query in SSMS to save the data.

johncquayle avatar Jun 08 '23 23:06 johncquayle

This issue still valid for MySQL extension and ADS 1.48 Edit 69 columns x 1000 rows, for smaller column count it succed.

moemura avatar Jun 07 '24 09:06 moemura