cmoog / vscode-sql-notebook

Open SQL files as VSCode Notebooks.
https://marketplace.visualstudio.com/items?itemName=cmoog.sqlnotebook
MIT License
120 stars 16 forks source link

It's not clear what is the CWD of the shell executing the SQL query #54

Open FallenChromium opened 1 year ago

FallenChromium commented 1 year ago

Hello! Thank you for this great extension, I love how it helps me to experiment with SQL DBs without losing any valuable info by creating tons of files (on the screenshot you can see what a mess was that before I've found this extension, LOL).

I have one issue with COPY .. FROM .. WITH CSV statements with the PostgreSQL driver though. The problem is that the queries executed in the notebook can't reach the csv files in my filesystem, and I'm not sure what's the correct path. Using absolute path works, but it kinda defeats the point of having a shareable folder with SQLs in it.

image

Is there a possibility to determine what's the cwd of SQL script file or to set it automatically/manually? I think cwd being set to the folder of the current file is the most intuitive solution.

cmoog commented 1 year ago

Thanks for the detailed info. I'll need to take a closer look to see if we can expose this as an option. I'm surprised it isn't defaulting to the workspace dir. Maybe it's defaulting to the cwd of the postgresql server process?