By default extension works on Windows but it requires requires WSL and Ubuntu 20.04 to be installed. Ubuntu is used to run ZetaSQL analyzer.
If it is not installed you will see the following warning:
To install WSL and Ubuntu 20.04 click Run command button or run the following command as Administrator (this requires a computer restart):
wsl --install -d Ubuntu-20.04
You can also run extension fully inside WSL or Docker Container:
- Install the Windows Subsystem for Linux along with your preferred Linux distribution.
- Install Visual Studio Code on the Windows side (not in WSL).
- Install the Remote Development extension pack.
Note: See the Visual Studio Code Remote - WSL documentation for more details.
VS Code runs extensions in one of the two places: locally on the UI / client side, or in WSL. You need to install dbt Language Server in WSL. See the Managing extensions documentation.
Note: See the detailed instructions on how to open remote folder or workspace.
- Open a WSL terminal window (using the start menu item or by typing
wsl
from a command prompt / PowerShell). - Navigate to a folder you'd like to open in VS Code (including, but not limited to, Windows filesystem mounts like
/mnt/c
). - Type
code .
in the terminal.
- Start VS Code.
- Press F1, select Remote-WSL: New Window for the default distro or Remote-WSL: New Window using Distro for a specific distro.
- Use the File menu to open your folder.
To open a WSL window directly from a Windows prompt, use the --remote
command line parameter:
code --remote wsl+<distro name> <path in WSL>
-
Install the Remote Development extension pack.
-
Create the
./.devcontainer/Dockerfile
file in your project root folder with the following content:ARG VARIANT="hirsute" FROM mcr.microsoft.com/vscode/devcontainers/base:0-${VARIANT}
-
Create
./.devcontainer/devcontainer.json
file in your project's root folder and paste the following content (see the Devcontainer.json Reference documentation for more information). Note: replace dbt-bigquery with your adapter, such as dbt-postgres.{ "name": "Ubuntu", "build": { "dockerfile": "Dockerfile", "args": { "VARIANT": "focal" } }, "settings": { "files.autoSave": "afterDelay" }, "extensions": ["Fivetran.dbt-language-server"], "onCreateCommand": "pip install dbt-bigquery", "remoteUser": "vscode", "features": { "python": "3.9" }, "mounts": ["source=C:/Users/your_user/.dbt/,target=/home/vscode/.dbt/,type=bind,readonly"] }
-
Replace the path in the
mounts
section with your actual paths. -
If you use any absolute path in your
.dbt/profiles.yml
, add one more mount for your path and change it in the.dbt/profiles.yml
:"source=C:/Users/your_user/.dbt/your-project-credentials.json,target=/Users/user/.dbt/your-project-credentials.json,type=bind,readonly",
-
Use Ctrl+Shift+P and the Remote-Containers: Reopen Folder Locally, Remote-Containers: Reopen in Container commands to switch between the local environment and docker container environment for your project.
Note: See the Developing inside a Container documentation for detailed instructions.