Datafold VS Code
With the Datafold VS Code Extension, you can quickly run and diff any dbt models, view and interact with diff results in a clean GUI, and automatically diff models that change, all within your VS Code IDE.
- Install the Datafold VS Code Extension using the VS Code Extension tab.
- Open up the extension's settings to set file paths for dbt profiles, your dbt project, and your Python installation.
💡 Set absolute paths in the Extension Settings to avoid any issues.
- Using the command palate (⌘⇧P on Mac, ⌃⇧P on Windows and Linux), install
data-diff by searching for "Datafold: Install data-diff".
- You'll be walked through a few steps including:
- setting up your
- setting the path to your
- selecting a data warehouse
- If you use custom schemas, just enter any text string in the "Enter your schema" step. This will populate the
var in your
dbt_project.yml with whatever value you entered. Then, you'll need to adjust your
following the steps in the Custom Schema section in our documentation.
This is what will be added to the
vars of your
dbt_project.yml once setup is complete:
Running your first Data Diff
You can diff dbt models by clicking on the bird of Datafold, which reveals a sidebar containing all of your dbt models.
Click on any model's "play" button to run a data diff between the development and production version of the model.
💡 In order for the data diff to run, there must be a version of the model in both your production and development environments.
Explore value-level differences
Understand exactly which values will change if the development code is merged to production.
You can search for Datafold commands by using the command palate (⌘⇧P on Mac, ⌃⇧P on Windows and Linux).
Try typing "Datafold: Diff dbt model"
💡 If a dbt model file is open, it will be diffed automatically.
💡 If a dbt model file is not open, you will be prompted to enter a model name.
You can also diff every model that was built in your most recent
By turning on Watch Mode, the Datafold VS Code extension will diff all models that are run in each
dbt run, as you code. Simply check this box in the Extension Settings.
💡 To prevent diffing too many models with Watch Mode on, be sure to select only a subset (e.g.,
dbt run --select dim_orgs+).
- You need to have dbt and Python 3.7 or newer installed.
- The datafold/data-diff package will be installed as a Python package. If you have a Python extension installed, the package will be installed in the currently selected Python environment. Otherwise, it will be installed in the default Python environment. Make sure that you select the correct Python environment in the status bar using the "Python: Select Interpreter" command if you have multiple Python environments installed.
Logs can be found in the Output panel under the Datafold channel.
The extension respects the log level configured with
Developer: Set Log Level command. By default, the extension uses the
info log level. To see more logs for debugging, change the log level:
- Open command palette (⌘⇧P on Mac, ⌃⇧P on Windows and Linux).
Developer: Set Log Level command.
Datafold channel and the log level to