dbt integration in Cortex Code Desktop

Cortex Code Desktop includes a built-in dbt panel that provides a full development environment for dbt projects. When you open a workspace containing a dbt_project.yml, the dbt panel activates automatically and gives you interactive lineage visualization, compiled SQL preview, data preview, documentation, and a command bar — all without leaving the editor.

dbt panel showing lineage graph, command bar, and project explorer

The dbt panel with the Lineage tab active, showing upstream/downstream model relationships and the command bar.

Getting started

The dbt panel appears in the bottom panel area (next to Problems, Output, Terminal, etc.) when Cortex Code detects a dbt_project.yml in your workspace. Click the DBT tab to open it.

The panel has five tabs and a command bar:

TabWhat it shows
LineageInteractive DAG graph of model dependencies
OutputReal-time output from dbt commands
DocsDocumentation for the selected model
CompiledFully resolved SQL with all Jinja rendered
PreviewData grid showing sample rows from the model

Execution mode

Cortex Code Desktop can run dbt commands two ways:

ModeWhere dbt runsWhat it requires
Local (default)The local dbt CLI on your machineA working local dbt installation
Snowflake-managedInside Snowflake via EXECUTE DBT PROJECT FROM WORKSPACEAn active Snowflake connection — no local dbt installation needed

In Snowflake-managed mode, your dbt project files are uploaded to a Snowflake workspace under your account, dbt executes server-side, and the generated artifacts (target/, dbt_packages/, package-lock.yml, logs) are downloaded back to your local project directory after each run. The Lineage, Output, Docs, and Compiled tabs work the same way in both modes — the difference is where the work happens.

dbt panel in Snowflake-managed mode showing the project picker, profile picker, Run/Stop buttons, and the Snowflake Managed mode badge

The dbt panel in Snowflake-managed mode. A Snowflake Managed badge in the panel header confirms which mode is active. The project picker selects which dbt project to run; the profile picker selects which target (within the profile defined in your project’s dbt_project.yml) the next run will use.

For the underlying Snowflake feature, see Workspaces for dbt projects on Snowflake.

Switching between modes

Change the active mode in any of three ways:

  • Settings UI — Search for dbt: Execution Mode and pick local or snowflake-managed.
  • settings.json — Set "dbt.executionMode": "snowflake-managed".
  • Command Palette — Run Toggle dbt Execution Mode (Snowflake-Managed/Local). A notification confirms the new mode.

Command Palette showing the Toggle dbt Execution Mode (Snowflake-Managed/Local) entry

The Command Palette entry for switching dbt execution mode.

When Snowflake-managed mode is active, the panel header shows a Snowflake Managed badge on every tab.

What happens when you run a command

When you run a dbt command in Snowflake-managed mode, Cortex Code Desktop:

  1. Ensures a workspace exists in your account at USER$.PUBLIC named coco_<project>_<hash>. The workspace is created on first use and reused on subsequent runs.
  2. Syncs your project files to the workspace. Only files that changed since the last sync are uploaded, so subsequent runs are fast.
  3. Executes the dbt command on Snowflake via EXECUTE DBT PROJECT FROM WORKSPACE. The warehouse, database, schema, and role specified in the active target (selected in the profile picker, defined in profiles.yml under the profile: named in dbt_project.yml) are used for the run.
  4. Downloads the generated artifacts back to your local project directory so the Compiled and Lineage tabs reflect the server-side run.

The Output tab shows the SQL that was executed and streams the dbt output. Click Stop to cancel a running command.

In Snowflake-managed mode, the Command bar and the Build / Compile / Show quick-action buttons (described later in this page) are hidden. Run dbt commands through the Run button and the execution popover instead.

Customizing a run

Click the chevron next to Run to open the execution popover and customize the next run:

Execution popover showing Operation, dbt Version, Additional flags, and External Access Integration fields

The execution popover with per-run controls.

FieldPurpose
OperationPick the dbt subcommand. The dropdown lists the supported subcommands, including deps, seed, compile, run, build, test, retry, parse, docs generate, list, show, snapshot, and run-operation.
dbt VersionChoose which dbt version Snowflake should use. Current options: 1.10.15 (dbt Core) and 2.0.0-preview (dbt Fusion engine, default).
Additional flagsFree-text flags appended to the dbt command (for example, --full-refresh or --vars '{"key": "value"}').
External Access IntegrationEAI to attach when dbt needs network access to fetch packages declared in packages.yml. The list shows EAIs your active role has USAGE or OWNERSHIP on. Leave empty if your project uses only local packages.

Note

With dbt Core, an EAI is required for dbt deps. With the dbt Fusion engine (default), dbt deps runs implicitly during dbt compile and dbt run if dbt_packages is missing, so the EAI may also be needed for those commands. See Understand dependencies for dbt projects on Snowflake.

Click Execute to run with the selected options.

Prerequisites for Snowflake-managed mode

  • An active Snowflake connection signed in via the connection picker.

  • A profiles.yml in each dbt project folder. The type must be snowflake and the warehouse, database, schema, and role fields must be set. Unlike dbt Core, the account and user fields can be left empty or with arbitrary values — the workspace runs under your current Snowflake user and account context. See Workspaces for dbt projects on Snowflake for the full requirements.

  • Personal databases enabled on your account. Snowflake workspaces are created in a personal database, which an account administrator must enable. See the personal database requirement.

  • An external access integration, only if your packages.yml references remote packages (for example, packages from the dbt Packages hub or a Git repository). The EAI is selected per-run in the execution popover; local-only dependencies don’t require one. See Workspaces for dbt projects on Snowflake — dependencies for setup details.

Project size limit

A dbt project synced to a Snowflake workspace can contain at most 20,000 files across all folders, including generated target/ and dbt_packages/ artifacts. See Limitations, requirements, and considerations.

Inspecting your workspaces

Each project gets a dedicated Snowflake workspace. The name has the shape coco_<project>_<hash>, where <project> is the lowercased project name (non-alphanumeric characters replaced with _) and <hash> is a 6-character hex tag. To list the workspaces Cortex Code Desktop has created in your account:

SHOW WORKSPACES LIKE 'coco_%' IN SCHEMA USER$.PUBLIC;

Workspaces persist between sessions, so the next sync only uploads what’s changed. If a workspace is dropped externally — for example by an administrator — Cortex Code Desktop re-creates it and performs a full sync on the next run.

Note

The Preview tab is not yet available in Snowflake-managed mode. The tab is hidden when this mode is active. Switch to Local mode to use the Preview tab.

Lineage

The Lineage tab renders an interactive directed acyclic graph (DAG) of your dbt project. It shows how models, sources, and other resources relate to each other.

  • Upstream / Downstream — Toggle between viewing ancestors (upstream) or dependents (downstream) of the selected node.
  • Depth — Control how many levels of dependencies to display (default: 5).
  • Navigation — Use the back/forward arrows to navigate through previously viewed nodes.
  • Refresh — Re-parse the project and update the graph.
  • Selection — Click nodes to select them. Use ⌘+Click to add/remove from selection, or Shift+Drag to select multiple.

Tip

Select one or more nodes in the lineage graph, then use the “Add to Chat” action to attach the selected models as context to your AI conversation. This helps the agent understand your project structure when answering questions or generating code.

Output

The Output tab displays real-time results from dbt commands. Each command execution appears as a collapsible entry showing:

  • The command that was run
  • Timestamp and duration
  • Exit code and status (running, success, or error)
  • Per-model progress during dbt run or dbt build

Click Clear All to remove the output history.

Docs

The Docs tab shows the documentation for the currently selected dbt resource. It displays model descriptions, column metadata, and relationships. From the docs view you can:

  • Navigate to related nodes by clicking their names.
  • Open the source file for any referenced model.
  • Trigger a compile to update the documentation.

Compiled

The Compiled tab shows the fully resolved SQL for the current model — all Jinja macros, refs, and sources are rendered into their final SQL form. This is the exact query that dbt would execute against your warehouse.

  • Source / Compiled toggle — Switch between viewing the raw source and the compiled output.
  • Syntax highlighting — Full SQL highlighting with line numbers and minimap.
  • Search — Use Ctrl+F (or ⌘+F) to search within the compiled SQL.
  • Copy — Copy the compiled SQL to your clipboard.

The status bar shows the model name and compilation duration.

Preview

Note

Available in Local mode only. The Preview tab is hidden in Snowflake-managed mode.

The Preview tab executes dbt show and displays the results in an interactive data grid. This lets you quickly inspect the output of a model without running a full build.

  • Click the Preview button (or use the Show action in the control bar) to fetch data.
  • The default row limit is 10; adjust it using the limit control in the grid header.
  • Results are cached per model until you re-run the preview or switch models.

Command bar

Note

Available in Local mode only. In Snowflake-managed mode, use the Run button and the execution popover (see Customizing a run) instead.

At the bottom of the dbt panel is a command bar where you can type and execute any dbt command directly. Type a command (for example, dbt run, dbt test, dbt compile) and press Run or hit Enter.

  • Use ↑ and ↓ arrow keys to navigate through command history.
  • Output from commands appears in the Output tab.

Quick actions

Note

Available in Local mode only. The Build, Compile, and Show buttons are hidden in Snowflake-managed mode. Use the Operation field in the execution popover instead.

The control bar also provides one-click buttons for common operations:

ButtonAction
BuildRuns dbt build for the current model
CompileCompiles the current model and updates the Compiled tab
Show / Stop ShowExecutes or cancels dbt show for the Preview tab

Project detection

Cortex Code automatically detects dbt projects by scanning your workspace for dbt_project.yml files. When a dbt file is open in the editor, the panel automatically focuses on the corresponding model in the lineage graph and updates the Docs, Compiled, and Preview tabs.

Note

A valid profiles.yml is required in both modes. In Local mode the project runs through the local dbt CLI, which uses profiles.yml exactly as documented by dbt. In Snowflake-managed mode the workspace also reads profiles.yml for warehouse, database, schema, and role, but the account and user fields can be empty or arbitrary because the workspace runs under your current Snowflake context.