# ignore\_external\_modifications

### Project YAML file

dbt\_project.yml

```yaml
models:
  <resource-path>:
    +state:
      ignore_external_modifications: true | false
```

### Properties YAML file

models/\<filename>.yml

```yaml
models:
  - name: my_model
    config:
      state:
        ignore_external_modifications: true | false
```

### SQL file config

models/\<filename>.sql

```sql
{{ config(
    state={
      "ignore_external_modifications": true | false
    }
) }}
```

## Definition

(Applies to dbt v2.0 and later)

By default, dbt State forces a rebuild when it detects that a node was changed outside of dbt since the last run (for example, by a direct change to the table in your warehouse).

`ignore_external_modifications` controls what dbt State does when the target table (the table or view a node builds) is changed outside of dbt. dbt State detects those changes by comparing the target table's last-modified timestamp in your warehouse against the timestamp it recorded on the previous run.

| Value             | Behavior                                                                                                                                     |
| ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
| `true`            | dbt State reuses a node even if it was modified outside of dbt.                                                                              |
| `false` (default) | dbt State rebuilds the node instead of reusing it. It also rebuilds if the warehouse timestamp or its own recorded timestamp is unavailable. |

With `ignore_external_modifications: true`, dbt State proceeds with cloning even if the clone source was modified since the last run. With `false`, dbt State builds the node instead of cloning it.

dbt sometimes identifies its own changes as external, which triggers a rebuild when this is `false`. We recommend setting `ignore_external_modifications` to `true` unless an external change should force a rebuild.

This config applies only to the node's own target table. dbt State always checks upstream nodes for modifications, regardless of this setting.

## Interactions with other configs

The following interactions apply when `ignore_external_modifications` is `false`.

* [`lag_tolerance`](./lag-tolerance.md): A model is rebuilt when an external change is detected, even if it was built recently enough to fall within its `lag_tolerance` window.

## Example

### Enforce strict ownership for a single model

Use `ignore_external_modifications: false` for models where external changes should trigger a rebuild:

models/schema.yml

```yaml
models:
  - name: fct_orders
    config:
      state:
        ignore_external_modifications: false
```

With this config set, dbt State triggers a rebuild the next time `fct_orders` runs if its last-modified timestamp in the warehouse is newer than what dbt State recorded, or if the warehouse timestamp or dbt State's recorded timestamp is unavailable.

## Related docs

* [About dbt State](../../docs/deploy/dbt-state-about.md)
* [Set up dbt State](../../docs/deploy/dbt-state-setup.md)
* [dbt State configurations](./dbt-state-configs.md)
