For data analysts and engineers, DBT as part of MATE has become a popular choice for transforming and modeling data. Its integration with Visual Studio Code (VSCode) through the DBT Power User Extension allows users to streamline their workflow and enhance productivity. However, some users have encountered a peculiar issue when SSH-ing to a DDE (DataOps Data Engineering) Cloud instance. In this article, we will explore the problem, its root cause, and the steps required to resolve it effectively.
The Issue at Hand
Users who access DDE Cloud instances through SSH and work with VSCode have reported that the Build and Run Buttons in the DBT Power User Extension fail to function as expected. Attempting to build or run a model through the extension in this scenario yields no results, leaving users frustrated and perplexed.
Root Cause
The reason behind this unexpected behavior lies in the configuration of the DBT Power User Extension and how it interacts with the DDE Cloud instance during an SSH connection.
When working on a local system, the extension can access the necessary project directories and files directly. However, when using an SSH connection to access a DDE Cloud instance, the extension does not inherently recognize the remote project's location. Consequently, the Build and Run Buttons cannot execute the necessary commands due to the disconnected project paths.
Solution: Adding Snippet to local settings.json
To overcome this issue, users need to make a minor adjustment to their local settings.json file in VSCode. By adding the following snippet to the settings.json file in the .vscode folder, we can explicitly provide the project directory information to the DBT Power User Extension:
{
"dbt.buildModelCommandAdditionalParams":
e "--project-dir", "workspace/PROJECT_NAME/dataops/modelling" ], "dbt.runModelCommandAdditionalParams":
e "--project-dir", "workspace/PROJECT_NAME/dataops/modelling" ]
}
Replace "PROJECT_NAME" with the actual name of your project directory.
Explanation of the Snippet
The provided snippet informs the DBT Power User Extension about the correct project directory path on the DDE Cloud instance. By adding these additional parameters, the extension can now effectively communicate with Dbt, even when working through an SSH connection.
How to Apply the Snippet
Follow these simple steps to add the snippet to your local settings.json file in VSCode:
-
Open Visual Studio Code on your local machine.
-
Navigate to the "File" menu and select "Preferences," then choose "Settings."
-
The settings page will open, displaying the "settings.json" file.
-
On the right-hand side of the page, you will find an editable text area for user settings. Enter the snippet provided above in this area.
-
Make sure to replace "PROJECT_NAME" with the appropriate name of your project directory.
-
Save the settings.json file (Ctrl + S or Cmd + S) to apply the changes.
-
Now, when you SSH into the DDE Cloud instance and access the DBT Power User Extension in VSCode, the Build and Run Buttons should function correctly.
While the DBT Power User Extension for Visual Studio Code significantly improves the efficiency of Dbt workflows, issues can arise when working on remote DDE Cloud instances through SSH connections. By adding a simple snippet to the local settings.json file, users can seamlessly enable the Build and Run Buttons to work as expected. This solution ensures that the power and convenience of Dbt and the DBT Power User Extension remain accessible, even in edge cases such as remote SSH connections to DDE Cloud instances. Happy MATE modelling!