## TL;DR

dbt-core expected the Snowflake adapter to provide snowflake_dml_explicit_transaction, but the installed adapter version does not define it, which means dbt-core and dbt-snowflake versions are out of step. Align them (upgrade dbt-snowflake to the series matching your dbt-core, in a clean virtual environment) and the internal macro resolves again.

```text
Runtime Error: adapter_macro 'snowflake_dml_explicit_transaction' not defined
```

## Use this when

- dbt run on Snowflake fails with Runtime Error adapter_macro snowflake_dml_explicit_transaction not defined
- the failure started after upgrading dbt-core or dbt-snowflake alone
- pip shows dbt-core and dbt-snowflake from different minor series

## Not for this skill when

- the missing macro is one of your own project macros, restore that file instead
- you are not on Snowflake, the analogous fix is still version alignment but for your adapter package
- a dispatch override in your project shadows adapter macros, fix the dispatch config

## Steps

1. Record installed versions: run pip show dbt-core dbt-snowflake (or dbt --version) and note both versions.
   Verify: you have the exact core and adapter versions in the failing environment.

2. Check the compatibility pairing: each dbt-snowflake minor series targets the same dbt-core minor series (for example 1.7 adapter with 1.7 core). Plan an upgrade or downgrade so the minors match.
   Verify: target versions are chosen with matching minor series.

3. Reinstall in a fresh virtual environment to avoid mixed old files: create the environment, install the pinned pair, for example dbt-core and dbt-snowflake at the chosen versions, then run dbt --version inside it.
   Verify: the clean environment shows the matched pair and no leftover packages.

4. Run dbt debug and dbt run --select on one incremental model, since transaction handling is exercised by DML.
   Verify: debug passes and the incremental model completes its merge without the adapter_macro error.

## Variant phrasings

### works locally, fails in dbt Cloud
Cloud environments pin their own dbt version per environment. Set the environment version to the series your repo expects, or align the repo to the Cloud version.

### fails only with explicit transactions config
Projects enabling explicit transaction handling hit this macro sooner. Version alignment is still the fix; removing the config only delays the collision.

Compatibility: dbt-core and dbt-snowflake must share a minor series (1.4 with 1.4, 1.7 with 1.7, and so on). Applies wherever pip manages the install, including CI images.

## Why it happens

dbt dispatches internal operations through adapter macros that live in the adapter package, not in core. Core calls the macro by name expecting the adapter of the matching series to provide it. When the adapter is older or newer than core expects, the dispatch finds no definition and raises this Runtime Error before any of your SQL runs.

## Edge cases / pitfalls

- In-place pip upgrades can leave stale adapter files that keep the error alive; the clean environment step is not optional when the error survives a version change.
- Pin both packages in requirements so CI and new hires get the matched pair.
- Other adapters have analogous internal macros; treat any adapter_macro not defined error as a version pairing smell first.

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_Fibrqz7nZMI10fsriURcfA
