Skip to content

Commit

Permalink
update faq to ref resource names (#5968)
Browse files Browse the repository at this point in the history
this pr updates the existing faq
(https://docs.getdbt.com/faqs/Models/unique-model-names) to include ref
resource names, not ust model name.

Resolves #5927
  • Loading branch information
mirnawong1 authored Aug 27, 2024
1 parent 2c0909c commit 77632e7
Show file tree
Hide file tree
Showing 14 changed files with 27 additions and 24 deletions.
2 changes: 1 addition & 1 deletion website/docs/docs/build/sql-models.md
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ You can also document and test models — skip ahead to the section on [test
<FAQ path="Project/example-projects" alt_header="Are there any example dbt models?" />
<FAQ path="Models/configurable-model-path" />
<FAQ path="Models/model-custom-schemas" />
<FAQ path="Models/unique-model-names" />
<FAQ path="Project/unique-resource-names" />
<FAQ path="Models/removing-deleted-models" />
<FAQ path="Project/structure-a-project" alt_header="As I create more models, how should I keep my project organized? What should I name my models?" />
<FAQ path="Models/insert-records" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ Support for BigQuery coming soon.

[**Deprecation date**](/reference/resource-properties/deprecation_date): Models can declare a deprecation date that will warn model producers and downstream consumers. This enables clear migration windows for versioned models, and provides a mechanism to facilitate removal of immature or little-used models, helping to avoid project bloat.

[Model names](/faqs/Models/unique-model-names) can be duplicated across different namespaces (projects/packages), so long as they are unique within each project/package. We strongly encourage using [two-argument `ref`](/reference/dbt-jinja-functions/ref#ref-project-specific-models) when referencing a model from a different package/project.
[Model names](/faqs/Project/unique-resource-names) can be duplicated across different namespaces (projects/packages), so long as they are unique within each project/package. We strongly encourage using [two-argument `ref`](/reference/dbt-jinja-functions/ref#ref-project-specific-models) when referencing a model from a different package/project.

More consistency and flexibility around packages. Resources defined in a package will respect variable and global macro definitions within the scope of that package.
- `vars` defined in a package's `dbt_project.yml` are now available in the resolution order when compiling nodes in that package, though CLI `--vars` and the root project's `vars` will still take precedence. See ["Variable Precedence"](/docs/build/project-variables#variable-precedence) for details.
Expand Down
13 changes: 0 additions & 13 deletions website/docs/faqs/Models/unique-model-names.md

This file was deleted.

12 changes: 12 additions & 0 deletions website/docs/faqs/Project/unique-resource-names.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
title: Do ref-able resource names need to be unique?
description: "Unique resource names to build dependencies"
sidebar_label: 'Resource names need to be unique'
id: unique-resource-names
---

Within one project: yes! To build dependencies between resources (such as models, seeds, and snapshots), you need to use the `ref` function, and pass in the resource name as an argument. dbt uses that resource name to uniquely resolve the `ref` to a specific resource. As a result, these resource names need to be unique, _even if they are in distinct folders_.

A resource in one project can have the same name as a resource in another project (installed as a dependency). dbt uses the project name to uniquely identify each resource. We call this "namespacing." If you `ref` a resource with a duplicated name, it will resolve to the resource within the same namespace (package or project), or raise an error because of an ambiguous reference. Use [two-argument `ref`](/reference/dbt-jinja-functions/ref#ref-project-specific-models) to disambiguate references by specifying the namespace.

Those resource will still need to land in distinct locations in the data warehouse. Read the docs on [custom aliases](/docs/build/custom-aliases) and [custom schemas](/docs/build/custom-schemas) for details on how to achieve this.
2 changes: 1 addition & 1 deletion website/docs/guides/azure-synapse-analytics-qs.md
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ Later, you can connect your business intelligence (BI) tools to these views and
#### FAQs {#faq-2}

<FAQ path="Runs/run-one-model" />
<FAQ path="Models/unique-model-names" />
<FAQ path="Project/unique-resource-names" />
<FAQ path="Project/structure-a-project" alt_header="As I create more models, how should I keep my project organized? What should I name my models?" />

</div>
Expand Down
2 changes: 1 addition & 1 deletion website/docs/guides/bigquery-qs.md
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ Later, you can connect your business intelligence (BI) tools to these views and
#### FAQs {#faq-2}

<FAQ path="Runs/run-one-model" />
<FAQ path="Models/unique-model-names" />
<FAQ path="Project/unique-resource-names" />
<FAQ path="Project/structure-a-project" alt_header="As I create more models, how should I keep my project organized? What should I name my models?" />

</div>
Expand Down
2 changes: 1 addition & 1 deletion website/docs/guides/databricks-qs.md
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ Later, you can connect your business intelligence (BI) tools to these views and
#### FAQs {#faq-2}
<FAQ path="Runs/run-one-model" />
<FAQ path="Models/unique-model-names" />
<FAQ path="Project/unique-resource-names" />
<FAQ path="Project/structure-a-project" alt_header="As I create more models, how should I keep my project organized? What should I name my models?" />
</div>
Expand Down
2 changes: 1 addition & 1 deletion website/docs/guides/manual-install-qs.md
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ This time, when you performed a `dbt run`, separate views/tables were created fo
### FAQs {#faq-2}

<FAQ path="Runs/run-one-model" />
<FAQ path="Models/unique-model-names" />
<FAQ path="Project/unique-resource-names" />
<FAQ path="Project/structure-a-project" alt_header="As I create more models, how should I keep my project organized? What should I name my models?" />

### Next steps
Expand Down
2 changes: 1 addition & 1 deletion website/docs/guides/microsoft-fabric-qs.md
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ Later, you can connect your business intelligence (BI) tools to these views and
#### FAQs {#faq-2}

<FAQ path="Runs/run-one-model" />
<FAQ path="Models/unique-model-names" />
<FAQ path="Project/unique-resource-names" />
<FAQ path="Project/structure-a-project" alt_header="As I create more models, how should I keep my project organized? What should I name my models?" />

</div>
Expand Down
2 changes: 1 addition & 1 deletion website/docs/guides/redshift-qs.md
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ Later, you can connect your business intelligence (BI) tools to these views and
#### FAQs {#faq-2}

<FAQ path="Runs/run-one-model" />
<FAQ path="Models/unique-model-names" />
<FAQ path="Project/unique-resource-names" />
<FAQ path="Project/structure-a-project" alt_header="As I create more models, how should I keep my project organized? What should I name my models?" />

</div>
Expand Down
1 change: 0 additions & 1 deletion website/docs/guides/sl-snowflake-qs.md
Original file line number Diff line number Diff line change
Expand Up @@ -921,7 +921,6 @@ metrics:
</File>
This semantic model uses simple metrics to focus on customer metrics and emphasizes customer dimensions like name, type, and order dates. It uniquely analyzes customer behavior, lifetime value, and order patterns.
## Test and query metrics
Expand Down
2 changes: 1 addition & 1 deletion website/docs/guides/snowflake-qs.md
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ Later, you can connect your business intelligence (BI) tools to these views and
#### FAQs {#faq-2}
<FAQ path="Runs/run-one-model" />
<FAQ path="Models/unique-model-names" />
<FAQ path="Project/unique-resource-names" />
<FAQ path="Project/structure-a-project" alt_header="As I create more models, how should I keep my project organized? What should I name my models?" />
## Build models on top of sources
Expand Down
2 changes: 1 addition & 1 deletion website/docs/guides/starburst-galaxy-qs.md
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ Later, you can connect your business intelligence (BI) tools to these views and
#### FAQs {#faq-2}

<FAQ path="Runs/run-one-model" />
<FAQ path="Models/unique-model-names" />
<FAQ path="Project/unique-resource-names" />
<FAQ path="Project/structure-a-project" alt_header="As I create more models, how should I keep my project organized? What should I name my models?" />

</div>
Expand Down
5 changes: 5 additions & 0 deletions website/vercel.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
"cleanUrls": true,
"trailingSlash": false,
"redirects": [
{
"source": "/faqs/Models/unique-model-names",
"destination": "/faqs/Project/unique-resource-names",
"permanent": true
},
{
"source": "/docs/deploy/dashboard-status-tiles",
"destination": "/docs/collaborate/data-tile",
Expand Down

0 comments on commit 77632e7

Please sign in to comment.