Skip to content

Commit

Permalink
Explain the default components of a FQN with examples included (#5192)
Browse files Browse the repository at this point in the history
[Preview](https://docs-getdbt-com-git-dbeatty10-patch-3-dbt-labs.vercel.app/reference/node-selection/methods#the-fqn-method)

## What are you changing in this pull request and why?

resolves: #5191

It was pointed out within
dbt-labs/dbt-core#9829 that it didn't seem
that the subdirectory path of a dbt model is included in the FQN and
will be utilized by the selector method.

So this PR adds a light explanation and some examples.

## More detail

The following is probably too granular detail to include in our docs
right now, but including here for completeness.

-
[Here](https://github.com/dbt-labs/dbt-core/blob/02d7727365cfb2fc7664797938412aec07018db2/core/dbt/parser/base.py#L171)
is the default way a FQN is constructed
- Versioned models have the [version
appended](https://github.com/dbt-labs/dbt-core/blob/02d7727365cfb2fc7664797938412aec07018db2/core/dbt/contracts/graph/node_args.py#L34)
as well
- [Some resource
types](https://github.com/dbt-labs/dbt-core/blob/02d7727365cfb2fc7664797938412aec07018db2/core/dbt/task/list.py#L97-L128)
don't emit the FQN during `dbt list` but rather a resource-specific
selector string
- Some resource types (exposure, metric, semantic model, saved query)
modify the default FQN formula
([example](https://github.com/dbt-labs/dbt-core/blob/02d7727365cfb2fc7664797938412aec07018db2/core/dbt/parser/schema_yaml_readers.py#L93-L94))
- Things like hooks or generic and singular data tests construct FQN in
a [different
way](https://github.com/dbt-labs/dbt-core/blob/02d7727365cfb2fc7664797938412aec07018db2/core/dbt/parser/README.md?plain=1#L143-L148)

## Checklist
- [x] Review the [Content style
guide](https://github.com/dbt-labs/docs.getdbt.com/blob/current/contributing/content-style-guide.md)
so my content adheres to these guidelines.
  • Loading branch information
matthewshaver authored Apr 1, 2024
2 parents a901096 + eaf3cbe commit ddca320
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion website/docs/reference/node-selection/methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,14 @@ dbt run --select "some_model"

### The "fqn" method

The `fqn` method is used to select nodes based off their "fully qualified names" (FQN) within the dbt graph. The default output of [`dbt list`](/reference/commands/list) is a listing of FQN.
The `fqn` method is used to select nodes based off their "fully qualified names" (FQN) within the dbt graph. The default output of [`dbt list`](/reference/commands/list) is a listing of FQN. The default FQN format is composed of the project name, subdirectories within the path, and the file name (without extension) separated by periods.

```bash
dbt run --select "fqn:some_model"
dbt run --select "fqn:your_project.some_model"
dbt run --select "fqn:some_package.some_other_model"
dbt run --select "fqn:some_path.some_model"
dbt run --select "fqn:your_project.some_path.some_model"
```

### The "package" method
Expand Down

0 comments on commit ddca320

Please sign in to comment.