DJ provides integrated dbt command execution directly from VS Code, allowing you to compile models, run transformations, and test your data models.
Before you begin: This guide assumes you have completed initial setup. See the Setup Guide first.
Related Documentation:
- Setup Guide - Initial installation and configuration
- Tutorial - Hands-on walkthrough
- Trino Integration - Query execution and catalog browsing
- Lightdash Integration - BI dashboard previews
- Running dbt Commands
- dbt Project Configuration
- Opening dbt Files
- Development Workflows
- Troubleshooting
DJ provides integrated dbt command execution directly from VS Code.
Compiles model to SQL without executing:
Method 1: Keyboard Shortcut
- Mac:
Cmd+Shift+C - Windows/Linux:
Ctrl+Shift+C
Method 2: Command Palette
- Open
.model.jsonfile - Run "DJ: Compile Model"
Method 3: Context Menu / Tree View
- Right-click model in Project Navigator tree view
- Select "Compile Model"
Compiling and running models (including run with upstream), showing compilation output in Output panel
Output:
- Opens Data Explorer panel
- Compilation logs appear in the Compilation Logs panel within Data Explorer
- Compiled SQL files are saved to
target/compiled/directory
Example: Compiling int__sales__orders__enriched.model.json generates SQL with left joins to customers and stores.
Opens an interactive UI for running dbt models with configurable options.
Method 1: Command Palette
- Run "DJ: Run Model" from Command Palette
Method 2: Actions Tree View
- Open "Actions" view in left sidebar
- Click "Run Model" item
Opening the Run Model UI, selecting a model, configuring run options, and viewing execution results
What the UI provides:
- Model Selection: Choose which model(s) to run
- Run Options:
- Run single model
- Run with upstream dependencies (
+model_name) - Run with downstream dependencies (
model_name+) - Full refresh option
- Defer to production option
Example workflow:
- Open Run Model UI
- Select mart__sales__reporting__revenue.model.json
- Choose "Run with upstream" to ensure dependencies are fresh
- Click "Run" and view real-time logs
Runs model and all upstream dependencies:
Command: "DJ: Run Model Lineage"
Equivalent to:
dbt run --select +model_nameUse Cases:
- Ensure upstream data is fresh
- First-time model run
- After schema changes in dependencies
Example: Running mart__sales__reporting__revenue with lineage will first run:
int__sales__orders__enriched(intermediate layer)stg__sales__orders__standardized,stg__customers__profiles__clean,stg__sales__stores__locations(staging layer)- Then finally
mart__sales__reporting__revenue
Queries the compiled model and displays results in Data Explorer:
Keyboard Shortcut:
- Mac:
Cmd+Enter - Windows/Linux:
Ctrl+Enter
Command Palette:
- Open
.model.json,.sql, or.ymlfile - Run "DJ: Preview Model"
What it does:
- Opens Data Explorer panel
- Executes a query against the compiled model (using
target/compiled/SQL) - Displays query results with data preview and SQL view
- Different from "Run Model" which materializes the model using
dbt run
Use Cases:
- Quick data preview without materializing
- Verify transformations are working correctly
- Debug SQL logic before running full pipeline
- Explore model output during development
Example: Preview mart__sales__reporting__revenue.model.json to see aggregated revenue data without running the full pipeline.
DJ automatically generates tests based on model type. Tests can be configured in VS Code settings:
Configuration:
{
"dj.autoGenerateTests": {
"tests": {
"equalRowCount": {
"enabled": false,
"applyTo": ["inner"],
"targetFolders": []
},
"equalOrLowerRowCount": {
"enabled": false,
"applyTo": ["left"],
"targetFolders": []
}
}
}
}Test Types:
equal_row_countfor inner joins (validates no row multiplication)equal_or_lower_row_countfor left joins (validates row count constraints)no_null_aggregatesfor aggregation checks
Running Tests:
Use standard dbt commands to run tests:
dbt test --select model_nameExample: In int__sales__orders__enriched.model.json, DJ can auto-generate equal_or_lower_row_count tests for the left joins to customers and stores when enabled in settings.
DJ integrates with dbt through your Python virtual environment. Key settings:
Python Virtual Environment:
{
"dj.pythonVenvPath": ".venv"
}DJ uses your configured Python venv to run dbt commands.
Multi-Project Support:
{
"dj.dbtProjectNames": ["analytics", "marketing"]
}Restrict DJ to specific dbt projects in workspace.
dbt Command Output:
All dbt output streams to VS Code Output panel:
- View → Output
- Select "DJ" from dropdown
For complete list of extension settings, see Setup Guide - Configure Extension Settings.
View Compiled SQL:
- Command: "DJ: Open Target Compiled SQL"
- Shortcut:
Cmd+'(Mac) /Ctrl+'(Windows/Linux) - Opens file from
target/compiled/ - Opens in split view beside current editor
- Shows final SQL sent to warehouse
View Run SQL:
- Command: "DJ: Open Target Run SQL"
- Opens file from
target/run/ - Shows executed SQL with run metadata
Jump to YAML:
- Shortcut:
Cmd+Shift+Y/Ctrl+Shift+Y - Opens generated
.ymlproperties file
- Create Model (Visual Editor or JSON)
- Compile (
Cmd+Shift+C) - Generate SQL - Run (DJ: Run Model) - Execute in warehouse
- Test (DJ: Test Model) - Validate data quality
- Iterate - Edit, compile, run, test
Example with jaffle_shop:
Create int__sales__orders__enriched.model.json → Compile to see join SQL → Run to materialize → Test to verify joins → Preview in Lightdash.
- Develop model with transformations
- Run model to materialize
- Auto-generated tests created by DJ
- Run tests (DJ: Test Model)
- Fix failures if any
- Commit when tests pass
Example: After creating a join model, DJ auto-generates equal_or_lower_row_count tests. Run tests to verify joins don't duplicate rows.
Check Python venv:
{
"dj.pythonVenvPath": ".venv"
}Verify dbt installation:
source .venv/bin/activate
dbt --versionCheck dbt_project.yml: Ensure file exists in workspace root
View dbt Output:
- View → Output
- Select "DJ" from dropdown
- Look for dbt command output and errors
- Trino Integration - Query execution and catalog browsing
- Lightdash Integration - BI dashboard previews
- Tutorial - Hands-on walkthrough
- Visual Editor - Create models visually
- Lineage Visualization - Explore model dependencies