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 Feb 23, 2024
2 parents db6bf1e + 48d2da3 commit 417f6e1
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 3 deletions.
3 changes: 3 additions & 0 deletions website/docs/docs/build/custom-aliases.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ The default implementation of `generate_alias_name` simply uses the supplied `al

</VersionBlock>

import WhitespaceControl from '/snippets/_whitespace-control.md';

<WhitespaceControl/>

### Dispatch macro - SQL alias management for databases and dbt packages

Expand Down
4 changes: 4 additions & 0 deletions website/docs/docs/build/custom-databases.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ The default implementation of `generate_database_name` simply uses the supplied

</File>

import WhitespaceControl from '/snippets/_whitespace-control.md';

<WhitespaceControl/>

<VersionBlock firstVersion="1.6">

### Managing different behaviors across packages
Expand Down
11 changes: 8 additions & 3 deletions website/docs/docs/build/custom-schemas.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@ The following code represents the default macro's logic:
{%- endmacro %}
```
<br />

import WhitespaceControl from '/snippets/_whitespace-control.md';

<WhitespaceControl/>


## Changing the way dbt generates a schema name

Expand All @@ -92,8 +98,7 @@ To customize this macro, copy the example code in the section [How does dbt gene

Be careful. dbt will ignore any custom `generate_schema_name` macros included in installed packages.

<details>
<summary>❗️ Warning: Don't replace <code>default_schema</code> in the macro.</summary>
<expandable alt_header="Warning: Don't replace `default_schema` in the macro">

If you're modifying how dbt generates schema names, don't just replace ```{{ default_schema }}_{{ custom_schema_name | trim }}``` with ```{{ custom_schema_name | trim }}``` in the ```generate_schema_name``` macro.

Expand All @@ -119,7 +124,7 @@ If you remove ```{{ default_schema }}```, it causes developers to override each
```

</details>
</expandable>

### generate_schema_name arguments

Expand Down
3 changes: 3 additions & 0 deletions website/docs/docs/build/jinja-macros.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ from app_data.payments

</File>

import WhitespaceControl from '/snippets/_whitespace-control.md';

<WhitespaceControl/>

### Using a macro from a package
A number of useful macros have also been grouped together into [packages](/docs/build/packages) — our most popular package is [dbt-utils](https://hub.getdbt.com/dbt-labs/dbt_utils/latest/).
Expand Down
8 changes: 8 additions & 0 deletions website/snippets/_whitespace-control.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<details>
<summary>💡 Use Jinja's whitespace control to tidy your macros!</summary>

When you're modifying macros in your project, you might notice extra white space in your code in the `target/compiled` folder.

You can remove unwanted spaces and lines with Jinja's [whitespace control](/faqs/Jinja/jinja-whitespace) by using a minus sign. For example, use `{{- ... -}}` or `{%- ... %}` around your macro definitions (such as `{%- macro generate_schema_name(...) -%} ... {%- endmacro -%}`).

</details>

0 comments on commit 417f6e1

Please sign in to comment.