Skip to content

Commit

Permalink
This branch was auto-updated!
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] authored Jul 20, 2024
2 parents d685d2f + a529ff4 commit a3d1ca8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
15 changes: 13 additions & 2 deletions website/docs/reference/dbt-jinja-functions/ref.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,21 @@
title: "About ref function"
sidebar_label: "ref"
id: "ref"
description: "Read this guide to understand the builtins Jinja function in dbt."
keyword: dbt mesh, project dependencies, ref, cross project ref, project dependencies
description: "Read this guide to understand the ref Jinja function in dbt."
keyword: dbt mesh, project dependencies, ref, cross project ref
---

```sql
select * from {{ ref("node_name") }}
```

## Definition

This function:
- Returns a [Relation](/reference/dbt-classes#relation) for a [model](/docs/build/models), [seed](/docs/build/seeds), or [snapshot](/docs/build/snapshots)
- Creates dependencies between the referenced node and the current model, which is useful for documentation and [node selection](/reference/node-selection/syntax)
- Compiles to the full object name in the database

The most important function in dbt is `ref()`; it's impossible to build even moderately complex models without it. `ref()` is how you reference one model within another. This is a very common behavior, as typically models are built to be "stacked" on top of one another. Here is how this looks in practice:

<File name='model_a.sql'>
Expand Down
4 changes: 2 additions & 2 deletions website/docs/reference/dbt-jinja-functions/source.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ description: "Read this guide to understand the source Jinja function in dbt."
---

```sql
select * from {{ source(source_name, table_name) }}
select * from {{ source("source_name", "table_name") }}
```

## Definition

This function:
- Returns a [Relation](/reference/dbt-classes#relation) for a [source](/docs/build/sources)
- Creates dependencies between a source and the current model, which is useful for documentation and model selection
- Creates dependencies between a source and the current model, which is useful for documentation and [node selection](/reference/node-selection/syntax)
- Compiles to the full object name in the database


Expand Down

0 comments on commit a3d1ca8

Please sign in to comment.