Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove callout and add tabs as examples #4402

Merged
merged 14 commits into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 41 additions & 5 deletions website/docs/reference/resource-configs/alias.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,47 @@ description: "Read this guide to understand the alias configuration in dbt."
datatype: string
mirnawong1 marked this conversation as resolved.
Show resolved Hide resolved
---

:::caution Heads up!
This is a work in progress document. While this configuration applies to multiple resource types, the documentation has only been written for seeds.

:::
<Tabs>
<TabItem value="model" label="Model">

Specify a custom alias for a model in your `dbt_project.yml` file.

For example, if you have a model that calculates `sales_metric`s and want to give it a more user-friendly alias, you can alias it like this:
mirnawong1 marked this conversation as resolved.
Show resolved Hide resolved

<File name='dbt_project.yml'>

```yml
models:
your_project:
sales_metrics:
+alias: sales_dashboard
```
</File>

This would return `analytics.finance.sales_dashboard` in the database, instead of the default `analytics.finance.sales_metrics`.
</TabItem>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or is it analytics.finance.unique_order_id_test? this makes me think it's the _ one?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we add config or is that only for properties.yml?


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

Configure a seed's alias in your `dbt_project.yml` file.

For example, if you have a seed that represents `product_categories` and want to alias it as `categories_data`, you would alias like this:

<File name='dbt_project.yml'>

```yml
seeds:
your_project:
product_categories:
+alias: categories_data
```

This would return the name `analytics.finance.categories_data` in the database.

</File>
</TabItem>
</Tabs>
mirnawong1 marked this conversation as resolved.
Show resolved Hide resolved

## Definition

mirnawong1 marked this conversation as resolved.
Show resolved Hide resolved
Expand All @@ -25,9 +62,8 @@ To learn more about changing the way that dbt generates a relation's `identifier
## Usage
mirnawong1 marked this conversation as resolved.
Show resolved Hide resolved

### Seeds
Configure a seed's alias in your `dbt_project.yml` file.

The seed at `seeds/country_codes.csv` will be built as a <Term id="table" /> named `country_mappings`.
In this example, the seed at `seeds/country_codes.csv` will be built as a <Term id="table" /> named `country_mappings`.
mirnawong1 marked this conversation as resolved.
Show resolved Hide resolved

<File name='dbt_project.yml'>

Expand Down
43 changes: 40 additions & 3 deletions website/docs/reference/resource-configs/database.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,47 @@ datatype: string
description: "Read this guide to understand the database configuration in dbt."
mirnawong1 marked this conversation as resolved.
Show resolved Hide resolved
---

:::caution Heads up!
This is a work in progress document. While this configuration applies to multiple resource types, the documentation has only been written for seeds.
<Tabs>
<TabItem value="model" label="Model">
mirnawong1 marked this conversation as resolved.
Show resolved Hide resolved

Specify a custom database for a model in your `dbt_project.yml` file.

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

<File name='dbt_project.yml'>

```yml
models:
your_project:
sales_metrics:
+database: reporting
```
</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>

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

Configure a database in your `dbt_project.yml` file.

For example, to load a seed into a database called `staging` instead of the target database, you can configure it like this:

<File name='dbt_project.yml'>

```yml
seeds:
your_project:
product_categories:
+database: staging
```

This would result in the generated relation being located in the `staging` database, so the full relation name would be `staging.finance.product_categories_data`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where did the _data suffix come from here?

Copy link
Contributor Author

@mirnawong1 mirnawong1 Nov 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh fudge! i think i copied the over from alias and didnt remove the _data bit


</File>
</TabItem>
</Tabs>

:::

## Definition

Expand Down
62 changes: 59 additions & 3 deletions website/docs/reference/resource-configs/schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,66 @@ description: "Schema - Read this in-depth guide to learn about configurations in
datatype: string
mirnawong1 marked this conversation as resolved.
Show resolved Hide resolved
---

:::caution Heads up!
This is a work in progress document. While this configuration applies to multiple resource types, the documentation has only been written for seeds.
<Tabs>
mirnawong1 marked this conversation as resolved.
Show resolved Hide resolved
<TabItem value="model" label="Model">

:::
Specify a custom schema for a group of models in your `dbt_project.yml` file or a [config block](/reference/resource-configs/schema#models).

For example, if you have a group of marketing-related models and you want to place them in a separate schema called `marketing`, you can configure it like this:

<File name='dbt_project.yml'>

```yml
models:
your_project:
marketing: # Grouping or folder for set of models
+schema: marketing
```
</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.marketing.model_name`.
</TabItem>

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

Configure a custom schema 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:

<File name='dbt_project.yml'>

```yml
seeds:
your_project:
product_mappings:
+schema: mappings
```

This would result in the generated relation being located in the `mappings` schema, so the full relation name would be `analytics.mappings.product_mappings_data`.
</File>
</TabItem>

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

Customize the schema 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
tests:
+store_failures: true
+schema: test_results
```

This would result in the test results being stored in the `test_results` schema.
</File>
</TabItem>
</Tabs>

Refer to [Usage](#usage) for more examples.

## Definition
Optionally specify a custom schema for a [model](/docs/build/sql-models) or [seed](/docs/build/seeds). (To specify a schema for a [snapshot](/docs/build/snapshots), use the [`target_schema` config](/reference/resource-configs/target_schema)).
Expand Down
Loading