> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sqlbuild.com/llms.txt
> Use this file to discover all available pages before exploring further.

# reconcile

> Diagnose and repair drift between virtual state and warehouse.

# sqb reconcile

Detects and repairs inconsistencies between the virtual state store and the warehouse. Virtual mode only.

## Usage

```bash theme={null}
sqb reconcile [--virtual-env <name>] [--model <name>]
sqb reconcile repair-view --virtual-env <name> --model <name>
sqb reconcile attach --virtual-env <name> --model <name> --physical-relation <relation>
```

## Subcommands

### (default)

Run a diagnostic report without changing anything:

```bash theme={null}
sqb reconcile --virtual-env dev
```

### repair-view

Recreate a logical VDE view from trusted state refs:

```bash theme={null}
sqb reconcile repair-view --virtual-env dev --model fact_orders
```

No confirmation needed. Idempotent (`CREATE OR REPLACE VIEW`).

### attach

Rebind a VDE model ref to a different tracked physical relation:

```bash theme={null}
sqb reconcile attach --virtual-env dev --model fact_orders \
  --physical-relation dev__sqb_physical.fact_orders__v_8f3a9c12
```

Requires confirmation by default.

## Examples

```bash theme={null}
# Diagnose issues
sqb reconcile --virtual-env dev

# Fix a missing view
sqb reconcile repair-view --virtual-env dev --model fact_orders

# Rebind a model to a different physical version
sqb reconcile attach --virtual-env dev --model fact_orders \
  --physical-relation dev__sqb_physical.fact_orders__v_71d0e4ab
```

See [Reconcile](/concepts/virtual-environments/reconcile) for details on guards and when to use each subcommand.
