---
title: "Syntax overview"
source: dbt Core Documentation
source_url: https://github.com/dbt-labs/docs.getdbt.com
licence: Apache-2.0
domain: data-and-analysis
subdomain: dbt-docs
date_added: 2026-04-25
---

dbt's node selection syntax makes it possible to run only specific resources in a given invocation of dbt. This selection syntax is used for the following subcommands:

<VersionBlock lastVersion="1.11">

| command                         | argument(s)                                                          |
| :------------------------------ | -------------------------------------------------------------------- |
| [run](/reference/commands/run)             | `--select`, `--exclude`, `--selector`, `--defer`                     |
| [test](/reference/commands/test)           | `--select`, `--exclude`, `--selector`, `--defer`                     |
| [seed](/reference/commands/seed)           | `--select`, `--exclude`, `--selector`                                |
| [snapshot](/reference/commands/snapshot)   | `--select`, `--exclude`, `--selector`                                |
| [ls (list)](/reference/commands/list)      | `--select`, `--exclude`, `--selector`, `--resource-type`             |
| [compile](/reference/commands/compile)     | `--select`, `--exclude`, `--selector`, `--inline`                    |
| [freshness](/reference/commands/source)    | `--select`, `--exclude`, `--selector`                                |
| [build](/reference/commands/build)         | `--select`, `--exclude`, `--selector`, `--resource-type`, `--defer`  |
| [docs generate](/reference/commands/cmd-docs) | `--select`, `--exclude`, `--selector`                             |

</VersionBlock>

<VersionBlock firstVersion="1.12">

| command                         | argument(s)                                                          |
| :------------------------------ | -------------------------------------------------------------------- |
| [run](/reference/commands/run)             | `--select`, `--exclude`, `--defer`                                   |
| [test](/reference/commands/test)           | `--select`, `--exclude`, `--defer`                                   |
| [seed](/reference/commands/seed)           | `--select`, `--exclude`                                              |
| [snapshot](/reference/commands/snapshot)   | `--select`, `--exclude`                                              |
| [ls (list)](/reference/commands/list)      | `--select`, `--exclude`, `--resource-type`                           |
| [compile](/reference/commands/compile)     | `--select`, `--exclude`, `--inline`                                  |
| [freshness](/reference/commands/source)    | `--select`, `--exclude`                                              |
| [build](/reference/commands/build)         | `--select`, `--exclude`, `--resource-type`, `--defer`                |
| [docs generate](/reference/commands/cmd-docs) | `--select`, `--exclude`                                           |

</VersionBlock>

:::info Nodes and resources

We use the terms ["nodes"](https://en.wikipedia.org/wiki/Vertex_(graph_theory)) and "resources" interchangeably. These encompass all the models, tests, sources, seeds, snapshots, exposures, and analyses in your project. They are the objects that make up dbt's DAG (directed acyclic graph).
:::

<VersionBlock lastVersion="1.11">

The `--select` and `--selector` arguments are similar in that they both allow you to select resources. To understand the difference, see [Differences between `--select` and `--selector`](/reference/node-selection/yaml-selectors#difference-between---select-and---selector).

</VersionBlock>

<VersionBlock firstVersion="1.12">

You can reference a named selector using the `selector:` method with `--select` or `--exclude`. To learn more, refer to [`selector:` method](/reference/node-selection/methods#selector).

</VersionBlock>

## Specifying resources

By default, `dbt run` executes _all_ of the models in the dependency graph; `dbt seed` creates all seeds, `dbt snapshot` performs every snapshot. The `--select` flag is used to specify a subset of nodes to execute.

To follow [POSIX standards](https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html) and make things easier to understand, we recommend CLI users use quotes when passing arguments to the `--select` or `--exclude` option (including single or multiple space-delimited, or comma-delimited arguments). Not using quotes might not work reliably on all operating systems, terminals, and user interfaces. For example, `dbt run --select "my_dbt_project_name"` runs all models in your project. 

### How does selection work?

1. dbt gathers all the resources that are matched by one or more of the `--select` criteria, in the order of [selection methods](/reference/node-selection/methods) (e.g. `tag:`), then [graph operators](/reference/node-selection/graph-operators) (e.g. `+`), then finally set operators ([unions](/reference/node-selection/set-operators#unions), [intersections](/reference/node-selection/set-operators#intersections), [exclusions](/reference/node-selection/exclude)).

import UsingCommas from '/snippets/_using-commas.md';


2. The selected resources may be models, sources, seeds, snapshots, tests. (Tests can also be selected "indirectly" via their parents; see [test selection examples](/reference/node-selection/test-selection-examples) for details.)

3. dbt now has a list of still-selected resources of varying types. As a final step, it tosses away any resource that does not match the resource type of the current task. (Only seeds are kept for `dbt seed`, only models for `dbt run`, only tests for `dbt test`, and so on.)

## Shorthand

Select resources to build (run, test, seed, snapshot) or check freshness: `--select`, `-s`

### Examples

By default, `dbt run` will execute _all_ of the models in the dependency graph. During development (and deployment), it is useful to specify only a subset of models to run. Use the `--select` flag with `dbt run` to select a subset of models to run. <VersionBlock lastVersion="1.11">Note that the following arguments (`--select`, `--exclude`, and `--selector`) also apply to other dbt tasks, such as `test` and `build`.</VersionBlock><VersionBlock firstVersion="1.12">Note that the following arguments (`--select` and `--exclude`) also apply to other dbt tasks, such as `test` and `build`.</VersionBlock>

<Tabs>
<TabItem value="select" label="Examples of select flag">

The `--select` flag accepts one or more arguments. Each argument can be one of:

1. a package name
2. a model name
3. a fully-qualified path to a directory of models
4. a selection method (`path:`, `tag:`, `config:`, `test_type:`, `test_name:`, `selector:`)

Examples:

```bash
dbt run --select "my_dbt_project_name"   # runs all models in your project
dbt run --select "my_dbt_model"          # runs a specific model
dbt run --select "path/to/my/models"     # runs all models in a specific directory
dbt run --select "my_package.some_model" # run a specific model in a specific package
dbt run --select "tag:nightly"           # run models with the "nightly" tag
dbt run --select "path/to/models"        # run models contained in path/to/models
dbt run --select "path/to/my_model.sql"  # run a specific model by its path
dbt run --select "selector:my_selector"  # run the node set defined by the named selector in selectors.yml; available starting v1.12
```
</TabItem>

<TabItem value="subset" label="Examples of subsets of nodes">

dbt supports a shorthand language for defining subsets of nodes. This language uses the following characters:

- plus operator [(`+`)](/reference/node-selection/graph-operators#the-plus-operator)
- at operator [(`@`)](/reference/node-selection/graph-operators#the-at-operator)
- asterisk operator (`*`)
- comma operator (`,`)

Examples:

```bash
# multiple arguments can be provided to --select
dbt run --select "my_first_model my_second_model"

# select my_model and all of its children
dbt run --select "my_model+"     

# select my_model, its children, and the parents of its children
dbt run --select @my_model          

# these arguments can be projects, models, directory paths, tags, or sources
dbt run --select "tag:nightly my_model finance.base.*"

# use methods and intersections for more complex selectors
dbt run --select "path:marts/finance,tag:nightly,config.materialized:table"

# combine a named selector with another method
dbt run --select "selector:staging,tag:nightly"
```

</TabItem>

</Tabs>

As your selection logic gets more complex, and becomes unwieldly to type out as command-line arguments, consider using a [yaml selector](/reference/node-selection/yaml-selectors).

<VersionBlock lastVersion="1.11">
You can use a predefined definition with the `--selector` flag. Note that when you're using `--selector`, dbt ignores `--select` and `--exclude`.

The `--select` and `--selector` arguments are similar in that they both allow you to select resources. To understand the difference, see [Differences between `--select` and `--selector`](/reference/node-selection/yaml-selectors#difference-between---select-and---selector).
</VersionBlock>

<VersionBlock firstVersion="1.12">

You can reference a predefined selector using the `selector:` method when using `--select` or `--exclude`. To learn more, refer to [`selector:` method](/reference/node-selection/methods#selector).

</VersionBlock>

### Troubleshoot with the `ls` command

Constructing and debugging your selection syntax can be challenging.  To get a "preview" of what will be selected, we recommend using the [`list` command](/reference/commands/list).  This command, when combined with your selection syntax, will output a list of the nodes that meet that selection criteria.  The `dbt ls` command supports all types of selection syntax arguments, for example:

```bash
dbt ls --select "path/to/my/models" # Lists all models in a specific directory.
dbt ls --select "source_status:fresher+" # Shows sources updated since the last dbt source freshness run.
dbt ls --select state:modified+ # Displays nodes modified in comparison to a previous state.
dbt ls --select "result:<status>+" state:modified+ --state ./<dbt-artifact-path> # Lists nodes that match certain [result statuses](/reference/node-selection/syntax#the-result-status) and are modified.
```
