Skip to main content

Compare changes in local development BetaEnterpriseEnterprise +

info

This feature is in beta and rolling out to dbt VS Code extension users on dbt platform Enterprise or Enterprise+ accounts.

The dbt VS Code extension previews and compares how your local edits affect your data in your dbt platform account — including added/removed rows and join verification — without waiting on CI.

Use compare changes to check impact early and validate changes before you open a PR or run a CI job:

  • Validate outputs are correct when refactoring logic, adding or removing columns, or implementing join modifications.
  • It compares your current working copy against your manifest.json (for example, your last production state) and shows changes to primary keys, rows, and columns in the Compare tab.

The dbt VS Code extension's compare changes feature is different from the Advanced CI compare changes feature, which runs at the PR stage in deployment rather than locally during development.

info

Compare changes in development is available for models only. Support for seeds, snapshots, ephemeral models, and Python models is coming soon.

Make changes to a model and see the changes in the Compare tabMake changes to a model and see the changes in the Compare tab

Prerequisites

To use the dbt VS Code extension compare changes feature, you need:

How it works

Compare changes in development works by comparing two materialized models in your warehouse. Specifically, it compares the model built in your dev schema (determined by your active profile) against the model referenced in your manifest.json (for example, your last production state). Both sides of the comparison are always warehouse tables; it does not compare SQL file contents.

  • If you're using dbt platform's deferral (recommended): You need at least one successful job run in the environment you are deferring to (usually staging or production). This allows Fusion to auto-download the deferred manifest and use that as your baseline state to compare against.
  • If you're manually setting a state directory: You can manually point the extension to a manifest.json (for example, copied from another environment) without needing a job run.

Use compare changes

To use compare changes in development, follow these steps:

  1. Open a SQL model file in your editor.
  2. Make some changes to the model, like adding a new column or modifying an existing one (for example, left_join_customers to right_join_customers).
  3. Run compare changes in the VS Code interface:
    • Command palette: Open the VS Code command palette (Shift + Command + P (Mac) / Ctrl + Shift + P (Windows/Linux)) and search for the dbt: Compare changes
    • Bottom panel: Click the Compare tab and then click the Compare button.
    Compare changes in developmentCompare changes in development
  4. Once you click the Compare button, the extension will execute a dbt build command to build the model you're working on and then runs the comparison. The Compare tab displays the changes to the data's primary keys, rows, and columns. Clicking the tabs will display more details about the changes, like specific columns that were added or modified.
  5. Once you've compared changes and see the changes in the Compare tab, you can then decide to commit your changes or continue editing.

Compare tab results

The Compare tab displays the changes to the data's primary keys, rows, and columns. Clicking the tabs will display more details about the changes, like specific columns that were added or modified.

Example of the Compare tabExample of the Compare tab
  • Overview tab: High-level summary about the changes to the models, such as the number of primary keys that were added or removed, rows modified, and so on. It will also include the relation between models that were added or modified.
  • Primary keys tab: Details about the changes to the records.
  • Modified rows tab: Details about the modified rows.
  • Columns tab: Details about the changes to the columns.

FAQs

 Are queries run on behalf of the developer?

Yes. All comparison queries in development are run using your local development credentials using the dbt_cloud.yml file, directly from the dbt VS Code extension. The dbt Fusion engine uses your credentials to execute comparison queries in your warehouse. The results are stored in memory, so that we can keep them populated into the Compare tab for that file until you re-run.

 Is this using my warehouse credits?

Yes. Because the comparison runs in your development environment using your dev credentials, it will use your warehouse’s compute.

 Do I need to run dbt build every time I make a change?

No. When you click Compare, the extension builds the model into your development schema automatically, so you don’t need to run dbt build yourself. It then compares that development build against the version in your deferred environment (usually staging or production).

If the model hasn’t been built yet in your deferred environment, the comparison can’t run. For more details, see Defer to production.

 How is this different from Advanced CI compare changes?

The dbt VS Code extension's compare changes feature applies only to your local development environment. If you're looking to compare changes between your production environment and the pull request's latest commit, check out Advanced CI compare changes.

AspectIn development (compare changes)In deployment (Advanced CI)
AffectsDevelopment for one modified model at a timeDeployment for all modified models in a project
TriggerOn-demand in editorPR open/update and CI job
ScopeYour working copy and local targetBranch head versus prod state in CI
Output locationCompare panel in VS Code/Cursor. Does not create a PR comment in Git providerDeployment job compare tab and PR summary comment in Git provider
Data cachingEditor-sidedbt platform caches limited samples
GovernanceLocal development credentialsProduction credentials

Was this page helpful?

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

0
Loading