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

add relative path snippet #6547

Merged
merged 15 commits into from
Nov 27, 2024
Merged
24 changes: 22 additions & 2 deletions website/docs/reference/project-configs/analysis-paths.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,32 @@ analysis-paths: [directorypath]
</File>

## Definition
Specify a custom list of directories where [analyses](/docs/build/analyses) are located.
Specify a custom list of directories where [analyses](/docs/build/analyses) are located.

## Default
Without specifying this config, dbt will not compile any `.sql` files as analyses.

However, the [`dbt init` command](/reference/commands/init) populates this value as `analyses` ([source](https://github.com/dbt-labs/dbt-starter-project/blob/HEAD/dbt_project.yml#L15))
However, the [`dbt init` command](/reference/commands/init) populates this value as `analyses` ([source](https://github.com/dbt-labs/dbt-starter-project/blob/HEAD/dbt_project.yml#L15)).

import RelativePath from '/snippets/_relative-path.md';

<RelativePath
path="analysis-paths"
Copy link
Contributor

Choose a reason for hiding this comment

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

Will these not work in the code examples? Is there something we can do to make them generic to include them in the snippet?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

unfortunately they dont seem to work w props. i spent longer than i should yesterday trying to get it to work and found it just easier to hardcode it. i think it could be generic but i found that it's better to be explicit with examples so users avoid having to guess or interpret.

absolute="/Users/username/project/analyses"
/>

- ✅ **Do:**
```yml
# Recommended relative path example
mirnawong1 marked this conversation as resolved.
Show resolved Hide resolved
analysis-paths: ["analyses"]
```

- ❌ **Don't:**
```yml
# Avoid using absolute paths
analysis-paths: ["/Users/username/project/analyses"]
```


## Examples
### Use a subdirectory named `analyses`
Expand Down
22 changes: 21 additions & 1 deletion website/docs/reference/project-configs/asset-paths.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,28 @@
## Definition
Optionally specify a custom list of directories to copy to the `target` directory as part of the `docs generate` command. This is useful for rendering images in your repository in your project documentation.


## Default
By default, dbt will not copy any additional files as part of docs generate, i.e. `asset-paths: []`
By default, dbt will not copy any additional files as part of docs generate, i.e. `asset-paths: []`.

Check warning on line 20 in website/docs/reference/project-configs/asset-paths.md

View workflow job for this annotation

GitHub Actions / vale

[vale] website/docs/reference/project-configs/asset-paths.md#L20

[custom.Typos] Oops there's a typo -- did you really mean 'i.e.'?
Raw output
{"message": "[custom.Typos] Oops there's a typo -- did you really mean 'i.e.'? ", "location": {"path": "website/docs/reference/project-configs/asset-paths.md", "range": {"start": {"line": 20, "column": 78}}}, "severity": "WARNING"}

Check warning on line 20 in website/docs/reference/project-configs/asset-paths.md

View workflow job for this annotation

GitHub Actions / vale

[vale] website/docs/reference/project-configs/asset-paths.md#L20

[custom.LatinAbbreviations] Avoid Latin abbreviations: 'that is'. Consider using 'i.e' instead.
Raw output
{"message": "[custom.LatinAbbreviations] Avoid Latin abbreviations: 'that is'. Consider using 'i.e' instead.", "location": {"path": "website/docs/reference/project-configs/asset-paths.md", "range": {"start": {"line": 20, "column": 78}}}, "severity": "WARNING"}
mirnawong1 marked this conversation as resolved.
Show resolved Hide resolved

import RelativePath from '/snippets/_relative-path.md';

<RelativePath
path="asset-paths"
absolute="/Users/username/project/assets"
/>

- ✅ **Do:**
```yml
# Recommended relative path example
asset-paths: ["assets"]
```

- ❌ **Don't:**
```yml
# Avoid using absolute paths
asset-paths: ["/Users/username/project/assets"]
```

## Examples
### Compile files in the `assets` subdirectory as part of `docs generate`
Expand Down
19 changes: 19 additions & 0 deletions website/docs/reference/project-configs/docs-paths.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,25 @@ By default, dbt will search in all resource paths for docs blocks (i.e. the comb

</VersionBlock>

import RelativePath from '/snippets/_relative-path.md';

<RelativePath
path="docs-paths"
absolute="/Users/username/project/docs"
/>

- ✅ **Do:**
```yml
# Recommended relative path example
docs-paths: ["docs"]
```

- ❌ **Don't:**
```yml
# Avoid using absolute paths
docs-paths: ["/Users/username/project/docs"]
```

## Example

Use a subdirectory named `docs` for docs blocks:
Expand Down
21 changes: 20 additions & 1 deletion website/docs/reference/project-configs/macro-paths.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,26 @@
Optionally specify a custom list of directories where [macros](/docs/build/jinja-macros#macros) are located. Note that you cannot co-locate models and macros.

## Default
By default, dbt will search for macros in a directory named `macros`, i.e. `macro-paths: ["macros"]`
By default, dbt will search for macros in a directory named `macros`, i.e. `macro-paths: ["macros"]`.

Check warning on line 19 in website/docs/reference/project-configs/macro-paths.md

View workflow job for this annotation

GitHub Actions / vale

[vale] website/docs/reference/project-configs/macro-paths.md#L19

[custom.LatinAbbreviations] Avoid Latin abbreviations: 'that is'. Consider using 'i.e' instead.
Raw output
{"message": "[custom.LatinAbbreviations] Avoid Latin abbreviations: 'that is'. Consider using 'i.e' instead.", "location": {"path": "website/docs/reference/project-configs/macro-paths.md", "range": {"start": {"line": 19, "column": 71}}}, "severity": "WARNING"}

Check warning on line 19 in website/docs/reference/project-configs/macro-paths.md

View workflow job for this annotation

GitHub Actions / vale

[vale] website/docs/reference/project-configs/macro-paths.md#L19

[custom.Typos] Oops there's a typo -- did you really mean 'i.e.'?
Raw output
{"message": "[custom.Typos] Oops there's a typo -- did you really mean 'i.e.'? ", "location": {"path": "website/docs/reference/project-configs/macro-paths.md", "range": {"start": {"line": 19, "column": 71}}}, "severity": "WARNING"}
mirnawong1 marked this conversation as resolved.
Show resolved Hide resolved

import RelativePath from '/snippets/_relative-path.md';

<RelativePath
path="macro-paths"
absolute="/Users/username/project/macros"
/>

- ✅ **Do:**
```yml
# Recommended relative path example
macro-paths: ["macros"]
```

- ❌ **Don't:**
```yml
# Avoid using absolute paths
macro-paths: ["/Users/username/project/macros"]
```

## Examples
### Use a subdirectory named `custom_macros` instead of `macros`
Expand Down
22 changes: 20 additions & 2 deletions website/docs/reference/project-configs/model-paths.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,26 @@
Optionally specify a custom list of directories where [models](/docs/build/models) and [sources](/docs/build/sources) are located.

## Default
By default, dbt will search for models and sources in the `models` directory, i.e. `model-paths: ["models"]`

By default, dbt will search for models and sources in the `models` directory, i.e. `model-paths: ["models"]`.

Check warning on line 18 in website/docs/reference/project-configs/model-paths.md

View workflow job for this annotation

GitHub Actions / vale

[vale] website/docs/reference/project-configs/model-paths.md#L18

[custom.LatinAbbreviations] Avoid Latin abbreviations: 'that is'. Consider using 'i.e' instead.
Raw output
{"message": "[custom.LatinAbbreviations] Avoid Latin abbreviations: 'that is'. Consider using 'i.e' instead.", "location": {"path": "website/docs/reference/project-configs/model-paths.md", "range": {"start": {"line": 18, "column": 79}}}, "severity": "WARNING"}

Check warning on line 18 in website/docs/reference/project-configs/model-paths.md

View workflow job for this annotation

GitHub Actions / vale

[vale] website/docs/reference/project-configs/model-paths.md#L18

[custom.Typos] Oops there's a typo -- did you really mean 'i.e.'?
Raw output
{"message": "[custom.Typos] Oops there's a typo -- did you really mean 'i.e.'? ", "location": {"path": "website/docs/reference/project-configs/model-paths.md", "range": {"start": {"line": 18, "column": 79}}}, "severity": "WARNING"}
mirnawong1 marked this conversation as resolved.
Show resolved Hide resolved

import RelativePath from '/snippets/_relative-path.md';

<RelativePath
path="model-paths"
absolute="/Users/username/project/models"
/>

- ✅ **Do:**
```yml
# Recommended relative path example
model-paths: ["models"]
```

- ❌ **Don't:**
```yml
# Avoid using absolute paths
model-paths: ["/Users/username/project/models"]
```
## Examples
### Use a subdirectory named `transformations` instead of `models`

Expand Down
21 changes: 20 additions & 1 deletion website/docs/reference/project-configs/seed-paths.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,26 @@

## Default

By default, dbt expects seeds to be located in the `seeds` directory, i.e. `seed-paths: ["seeds"]`
By default, dbt expects seeds to be located in the `seeds` directory, i.e. `seed-paths: ["seeds"]`.

Check warning on line 19 in website/docs/reference/project-configs/seed-paths.md

View workflow job for this annotation

GitHub Actions / vale

[vale] website/docs/reference/project-configs/seed-paths.md#L19

[custom.Typos] Oops there's a typo -- did you really mean 'i.e.'?
Raw output
{"message": "[custom.Typos] Oops there's a typo -- did you really mean 'i.e.'? ", "location": {"path": "website/docs/reference/project-configs/seed-paths.md", "range": {"start": {"line": 19, "column": 71}}}, "severity": "WARNING"}

Check warning on line 19 in website/docs/reference/project-configs/seed-paths.md

View workflow job for this annotation

GitHub Actions / vale

[vale] website/docs/reference/project-configs/seed-paths.md#L19

[custom.LatinAbbreviations] Avoid Latin abbreviations: 'that is'. Consider using 'i.e' instead.
Raw output
{"message": "[custom.LatinAbbreviations] Avoid Latin abbreviations: 'that is'. Consider using 'i.e' instead.", "location": {"path": "website/docs/reference/project-configs/seed-paths.md", "range": {"start": {"line": 19, "column": 71}}}, "severity": "WARNING"}
mirnawong1 marked this conversation as resolved.
Show resolved Hide resolved

import RelativePath from '/snippets/_relative-path.md';

<RelativePath
path="seed-paths"
absolute="/Users/username/project/seed"
/>

- ✅ **Do:**
```yml
# Recommended relative path example
seed-paths: ["seed"]
```

- ❌ **Don't:**
```yml
# Avoid using absolute paths
seed-paths: ["/Users/username/project/seed"]
```

## Examples
### Use a subdirectory named `custom_seeds` instead of `seeds`
Expand Down
22 changes: 21 additions & 1 deletion website/docs/reference/project-configs/snapshot-paths.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,27 @@
</VersionBlock>

## Default
By default, dbt will search for snapshots in the `snapshots` directory, i.e. `snapshot-paths: ["snapshots"]`
By default, dbt will search for snapshots in the `snapshots` directory, i.e. `snapshot-paths: ["snapshots"]`.

Check warning on line 27 in website/docs/reference/project-configs/snapshot-paths.md

View workflow job for this annotation

GitHub Actions / vale

[vale] website/docs/reference/project-configs/snapshot-paths.md#L27

[custom.LatinAbbreviations] Avoid Latin abbreviations: 'that is'. Consider using 'i.e' instead.
Raw output
{"message": "[custom.LatinAbbreviations] Avoid Latin abbreviations: 'that is'. Consider using 'i.e' instead.", "location": {"path": "website/docs/reference/project-configs/snapshot-paths.md", "range": {"start": {"line": 27, "column": 73}}}, "severity": "WARNING"}

Check warning on line 27 in website/docs/reference/project-configs/snapshot-paths.md

View workflow job for this annotation

GitHub Actions / vale

[vale] website/docs/reference/project-configs/snapshot-paths.md#L27

[custom.Typos] Oops there's a typo -- did you really mean 'i.e.'?
Raw output
{"message": "[custom.Typos] Oops there's a typo -- did you really mean 'i.e.'? ", "location": {"path": "website/docs/reference/project-configs/snapshot-paths.md", "range": {"start": {"line": 27, "column": 73}}}, "severity": "WARNING"}


import RelativePath from '/snippets/_relative-path.md';

<RelativePath
path="snapshot-paths"
absolute="/Users/username/project/snapshots"
/>

- ✅ **Do:**
```yml
# Recommended relative path example
snapshot-paths: ["snapshots"]
```

- ❌ **Don't:**
```yml
# Avoid using absolute paths
snapshot-paths: ["/Users/username/project/snapshots"]
```

## Examples
### Use a subdirectory named `archives` instead of `snapshots`
Expand Down
19 changes: 19 additions & 0 deletions website/docs/reference/project-configs/test-paths.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,25 @@ Without specifying this config, dbt will search for tests in the `tests` directo
- Generic test definitions in the `tests/generic` subdirectory
- Singular tests (all other files)

import RelativePath from '/snippets/_relative-path.md';

<RelativePath
path="test-paths"
absolute="/Users/username/project/test"
/>

- ✅ **Do:**
```yml
# Recommended relative path example
test-paths: ["test"]
```

- ❌ **Don't:**
```yml
# Avoid using absolute paths
test-paths: ["/Users/username/project/test"]
```

## Examples
### Use a subdirectory named `custom_tests` instead of `tests` for data tests

Expand Down
1 change: 1 addition & 0 deletions website/snippets/_relative-path.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<span>Paths specified in <code>{props.path}</code> must be relative to the location of your `dbt_project.yml` file. Avoid using absolute paths like <code>{props.absolute}</code>, as they may lead to unexpected behavior.</span>
mirnawong1 marked this conversation as resolved.
Show resolved Hide resolved
Loading