> ## 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.

# plan

> Preview what SQLBuild will do before executing.

# sqb plan

Shows the execution plan without making any changes. Useful for inspecting change detection, backfill policies, and selector scope before building.

## Usage

```bash theme={null}
sqb --project-dir <path> plan [flags]
```

## Flags

| Flag                  | Description                                                          |
| --------------------- | -------------------------------------------------------------------- |
| `--no-sql-validation` | Skip compile-time SQL syntax validation                              |
| `--changes-only`      | Narrow the plan to only stale models; prune anything already current |
| `--no-python`         | Exclude read-side Python tasks and assets from the plan              |
| `--defer-to`          | Resolve unselected model references against another target           |
| `--json`              | Output the plan as JSON                                              |
| `--full-refresh`      | Plan a full rebuild of all selected models                           |
| `--start-cursor-ts`   | Override start cursor for timestamp incremental models (ISO format)  |
| `--end-cursor-ts`     | Override end cursor for timestamp incremental models (ISO format)    |
| `--start-cursor-int`  | Override start cursor for integer incremental models                 |
| `--end-cursor-int`    | Override end cursor for integer incremental models                   |
| `--select`, `-s`      | Select specific models                                               |
| `--exclude`           | Exclude specific models                                              |

## Output

First run:

```
Plan ready (13 selected)

First run (12)
  stg_customers               view
  stg_payments                view
  stg_orders                  view
  daily_order_partitioned     partition_tracked (custom)
  daily_revenue               table
  dim_customers               table
  fact_orders                 table
  customer_status_snapshot    merge (timestamp)
  hourly_order_activity       delete_insert (timestamp, microbatch)
  daily_activity_rollup       delete_insert (timestamp, microbatch)
  hourly_activity_with_daily_context delete_insert (timestamp, microbatch)
  order_status_index          delete_insert (integer)

Seeds (1)
  waffle_types
```

Steady state:

```
Plan ready (13 selected)

Normal (12)
    3 view
    3 table
    3 delete_insert (timestamp, microbatch)
    1 partition_tracked (custom)
    1 merge (timestamp)
    1 delete_insert (integer)

Seeds (1)
  waffle_types
```

When query or schema changes are detected, the plan shows the affected models with backfill actions and cascade information.

## Missing upstream dependencies

Planning a scoped selection whose upstream inputs were never built in the target fails with `S301` rather than producing a plan that would break at build time:

```
error[S301]: cannot build selected scope: 3 missing upstream dependencies (stg_orders, stg_payments, waffle_types)
```

Build the upstream chain first, or select it along with the model: `sqb build --select +fact_orders`. On targets with [`reuse_from`](/concepts/reuse-from-production) configured, missing upstream inputs can instead be cloned from the reuse origin.
