Skip to content

Commit

Permalink
Merge branch 'current' into add-version-snippet
Browse files Browse the repository at this point in the history
  • Loading branch information
mirnawong1 authored Dec 23, 2024
2 parents e8fc174 + c81c5e9 commit 6b4c631
Show file tree
Hide file tree
Showing 8 changed files with 102 additions and 17 deletions.
4 changes: 2 additions & 2 deletions website/docs/docs/core/pip-install.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ dbt-env\Scripts\activate # activate the environment for Windows

#### Create an alias

To activate your dbt environment with every new shell window or session, you can create an alias for the source command in your $HOME/.bashrc, $HOME/.zshrc, or whichever config file your shell draws from.
To activate your dbt environment with every new shell window or session, you can create an alias for the source command in your `$HOME/.bashrc`, `$HOME/.zshrc`, or whichever config file your shell draws from.

For example, add the following to your rc file, replacing <PATH_TO_VIRTUAL_ENV_CONFIG> with the path to your virtual environment configuration.
For example, add the following to your rc file, replacing `<PATH_TO_VIRTUAL_ENV_CONFIG>` with the path to your virtual environment configuration.

```shell
alias env_dbt='source <PATH_TO_VIRTUAL_ENV_CONFIG>/bin/activate'
Expand Down
9 changes: 4 additions & 5 deletions website/docs/reference/resource-configs/alias.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ seeds:

<TabItem value="snapshot" label="Snapshots">

Configure a snapshots's alias in your `dbt_project.yml` file or config block.
Configure a snapshots's alias in your `dbt_project.yml` file, `snapshots/snapshot_name.yml` file, or config block.

The following examples demonstrate how to `alias` a snapshot named `your_snapshot` to `the_best_snapshot`.

Expand All @@ -117,18 +117,17 @@ snapshots:
```
</File>

In the `snapshots/properties.yml` file:
In the `snapshots/snapshot_name.yml` file:

<File name='snapshots/properties.yml'>
<File name='snapshots/snapshot_name.yml'>

```yml
version: 2
snapshots:
- name: your_snapshot
- name: your_snapshot_name
config:
alias: the_best_snapshot
```
</File>
In `snapshots/your_snapshot.sql` file:
Expand Down
2 changes: 0 additions & 2 deletions website/docs/reference/resource-configs/contract.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ default_value: {enforced: false}
id: "contract"
---

Supported in dbt v1.5 and higher.

When the `contract` configuration is enforced, dbt will ensure that your model's returned dataset exactly matches the attributes you have defined in yaml:
- `name` and `data_type` for every column
- Additional [`constraints`](/reference/resource-properties/constraints), as supported for this materialization and data platform
Expand Down
17 changes: 16 additions & 1 deletion website/docs/reference/resource-configs/database.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ models:
```
</File>
This would result in the generated relation being located in the `reporting` database, so the full relation name would be `reporting.finance.sales_metrics` instead of the default target database.
</TabItem>

Expand Down Expand Up @@ -55,7 +56,7 @@ Available for dbt Cloud release tracks or dbt Core v1.9+. Select v1.9 or newer f

<VersionBlock firstVersion="1.9">

Specify a custom database for a snapshot in your `dbt_project.yml` or config file.
Specify a custom database for a snapshot in your `dbt_project.yml`, snapshot.yml file, or config file.

For example, if you have a snapshot that you want to load into a database other than the target database, you can configure it like this:

Expand All @@ -69,6 +70,20 @@ snapshots:
```
</File>

Or in a `snapshot_name.yml` file:

<File name='snapshots/snapshot_name.yml'>

```yaml
version: 2
snapshots:
- name: snapshot_name
[config](/reference/resource-properties/config):
database: snapshots
```
</File>

This results in the generated relation being located in the `snapshots` database so the full relation name would be `snapshots.finance.your_snapshot` instead of the default target database.

</VersionBlock>
Expand Down
22 changes: 20 additions & 2 deletions website/docs/reference/resource-configs/enabled.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,28 @@ snapshots:

</File>

<VersionBlock firstVersion="1.9">

<File name='snapshots/snapshot_name.yml'>

```yaml
version: 2

snapshots:
- name: snapshot_name
[config](/reference/resource-properties/config):
enabled: true | false
```
</File>
</VersionBlock>
<File name='snapshots/<filename>.sql'>
```sql
# Configuring in a SQL file is a legacy method and not recommended. Use the YAML file instead.

{% snapshot [snapshot_name](snapshot_name) %}

{{ config(
Expand All @@ -90,11 +109,10 @@ snapshots:
select ...

{% endsnapshot %}

```

</File>


</TabItem>

<TabItem value="tests">
Expand Down
15 changes: 15 additions & 0 deletions website/docs/reference/resource-configs/group.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,21 @@ snapshots:
</File>
<VersionBlock firstVersion="1.9">
<File name='snapshots/properties.yml'>
```yaml
version: 2

snapshots:
- name: snapshot_name
[config](/reference/resource-properties/config):
group: GROUP_NAME
```
</File>
</VersionBlock>
<File name='snapshots/<filename>.sql'>
```sql
Expand Down
17 changes: 17 additions & 0 deletions website/docs/reference/resource-configs/persist_docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,23 @@ snapshots:

</File>

<VersionBlock firstVersion="1.9">
<File name='snapshots/snapshot_name.yml'>

```yaml
version: 2

snapshots:
- name: snapshot_name
[config](/reference/resource-properties/config):
persist_docs:
relation: true
columns: true
```
</File>
</VersionBlock>
<File name='snapshots/<filename>.sql'>
```sql
Expand Down
33 changes: 28 additions & 5 deletions website/docs/reference/resource-configs/schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,14 @@ models:
```
</File>
This would result in the generated relations for these models being located in the `marketing` schema, so the full relation names would be `analytics.target_schema_marketing.model_name`. This is because the schema of the relation is `{{ target.schema }}_{{ schema }}`. The [definition](#definition) section explains this in more detail.

</TabItem>

<TabItem value="seeds" label="Seeds">

Configure a custom schema in your `dbt_project.yml` file.
Configure a [custom schema](/docs/build/custom-schemas#understanding-custom-schemas) in your `dbt_project.yml` file.

For example, if you have a seed that should be placed in a separate schema called `mappings`, you can configure it like this:

Expand All @@ -50,16 +51,18 @@ This would result in the generated relation being located in the `mappings` sche

<VersionBlock lastVersion="1.8">

Available in dbt Core v1.9+. Select v1.9 or newer from the version dropdown to view the configs. Try it now in the [dbt Cloud "Latest" release track](/docs/dbt-versions/cloud-release-tracks).
Available in dbt Core v1.9 and higher. Select v1.9 or newer from the version dropdown to view the configs. Try it now in the [dbt Cloud "Latest" release track](/docs/dbt-versions/cloud-release-tracks).

</VersionBlock>

<VersionBlock firstVersion="1.9">

Specify a custom schema for a snapshot in your `dbt_project.yml` or config file.
Specify a [custom schema](/docs/build/custom-schemas#understanding-custom-schemas) for a snapshot in your `dbt_project.yml` or YAML file.

For example, if you have a snapshot that you want to load into a schema other than the target schema, you can configure it like this:

In a `dbt_project.yml` file:

<File name='dbt_project.yml'>

```yml
Expand All @@ -70,6 +73,21 @@ snapshots:
```
</File>

In a `snapshots/snapshot_name.yml` file:

<File name='snapshots/snapshot_name.yml'>

```yaml
version: 2
snapshots:
- name: snapshot_name
[config](/reference/resource-properties/config):
schema: snapshots
```

</File>

This results in the generated relation being located in the `snapshots` schema so the full relation name would be `analytics.snapshots.your_snapshot` instead of the default target schema.

</VersionBlock>
Expand All @@ -78,20 +96,25 @@ This results in the generated relation being located in the `snapshots` schema s

<TabItem value="saved-queries" label="Saved queries">

Specify a [custom schema](/docs/build/custom-schemas#understanding-custom-schemas) for a [saved query](/docs/build/saved-queries#parameters) in your `dbt_project.yml` or YAML file.

<File name='dbt_project.yml'>
```yml
saved-queries:
+schema: metrics
```
</File>

This would result in the saved query being stored in the `metrics` schema.

</TabItem>

<TabItem value="tests" label="Test">

Customize the schema for storing test results in your `dbt_project.yml` file.
Customize a [custom schema](/docs/build/custom-schemas#understanding-custom-schemas) for storing test results in your `dbt_project.yml` file.

For example, to save test results in a specific schema, you can configure it like this:


<File name='dbt_project.yml'>

```yml
Expand Down

0 comments on commit 6b4c631

Please sign in to comment.