Skip to content

Commit

Permalink
Merge branch 'current' into nfiann-prehook-emptyflag
Browse files Browse the repository at this point in the history
  • Loading branch information
nataliefiann authored Oct 16, 2024
2 parents 2fa5ba4 + f1e38ab commit bc0ad6a
Show file tree
Hide file tree
Showing 8 changed files with 82 additions and 194 deletions.
53 changes: 49 additions & 4 deletions contributing/adding-page-components.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ You can use the following components to provide code snippets for each supported

Identify code by labeling with the warehouse names:

```code
```sql
<WHCode>

<div warehouse="warehouse#1">
Expand Down Expand Up @@ -32,7 +32,7 @@ You can use the following components to provide code snippets in a tabbed view.

Identify code and code files by labeling with the component they are describing:

```code
```sql
<Tabs
defaultValue="models"
values={[
Expand Down Expand Up @@ -91,11 +91,11 @@ Identify code and code files by labeling with the component they are describing:

### Link to tabbed content

You can use the [queryString](https://docusaurus.io/docs/next/markdown-features/tabs?current-os=ios#query-string) prop in the `<Tabs>` tag. This allows you to share a link to a page with a pre-selected tab so that clicking on a tab creates a unique hyperlink for that tab. However, this feature doesn't provide an anchor link, which means the browser won't scroll to the tab. Additionally, you can define the search parameter name to use. If the tabs content is under a header, you can alternatively link to the header itself, instaed of the `queryString` prop.
You can use the [queryString](https://docusaurus.io/docs/next/markdown-features/tabs?current-os=ios#query-string) prop in the `<Tabs>` tag. This allows you to share a link to a page with a pre-selected tab so that clicking on a tab creates a unique hyperlink for that tab. However, this feature doesn't provide an anchor link, which means the browser won't scroll to the tab. Additionally, you can define the search parameter name to use. If the tabs content is under a header, you can alternatively link to the header itself, instead of the `queryString` prop.

In the following example, clicking a tab adds a search parameter to the end of the URL: `?current-os=android or ?current-os=ios`.

```
```sql
<Tabs queryString="current-os">
<TabItem value="android" label="Android">
Android
Expand All @@ -105,3 +105,48 @@ In the following example, clicking a tab adds a search parameter to the end of t
</TabItem>
</Tabs>
```

## Markdown Links

Refer to the <a href="https://github.com/dbt-labs/docs.getdbt.com/blob/current/contributing/content-style-guide.md#Links" target="_blank" rel="noreferrer">Links section</a> of the Content Style Guide to read about how you can use links in the dbt product documentation.

## Collapsible header

<Collapsible header="The header info">
<div>
<p>Shows and hides children elements</p>
</div>
</Collapsible>

```markdown
<Collapsible header="The header info">
<div>
<p>Shows and hides children elements</p>
</div>
</Collapsible>
</div>
```

## File component

```yml
<File name="~/.dbt/profiles.yml">

```yaml
password: hunter2
```
</File>
```

## LoomVideo component

<pre>{`<LoomVideo id="09919ddb02e44015878c9e93e15fe792" />`}</pre>

<LoomVideo id="09919ddb02e44015878c9e93e15fe792" />

## YoutubeVideo component

<pre>{`<YoutubeVideo id="5yyGT1k2xzY" />`}</pre>

<YoutubeVideo id="5yyGT1k2xzY" />

20 changes: 18 additions & 2 deletions website/docs/docs/build/data-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,25 @@ having total_amount < 0

</File>

The name of this test is the name of the file: `assert_total_payment_amount_is_positive`. Simple enough.
The name of this test is the name of the file: `assert_total_payment_amount_is_positive`.

Singular data tests are easy to write—so easy that you may find yourself writing the same basic structure over and over, only changing the name of a column or model. By that point, the test isn't so singular! In that case, we recommend...
To add a data test to your project, add a `.yml` file to your `tests` directory, for example, `tests/schema.yml` with the following content:

<File name='tests/schema.yml'>

```yaml
version: 2
data_tests:
- name: assert_total_payment_amount_is_positive
description: >
Refunds have a negative amount, so the total amount should always be >= 0.
Therefore return records where total amount < 0 to make the test fail.
```
</File>
Singular data tests are so easy that you may find yourself writing the same basic structure repeatedly, only changing the name of a column or model. By that point, the test isn't so singular! In that case, we recommend generic data tests.
## Generic data tests
Certain data tests are generic: they can be reused over and over again. A generic data test is defined in a `test` block, which contains a parametrized query and accepts arguments. It might look like:
Expand Down
2 changes: 1 addition & 1 deletion website/docs/docs/build/incremental-microbatch.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ Several configurations are relevant to microbatch models, and some are required:
|----------|------|---------------|---------|
| `event_time` | Column (required) | The column indicating "at what time did the row occur." Required for your microbatch model and any direct parents that should be filtered. | N/A |
| `begin` | Date (required) | The "beginning of time" for the microbatch model. This is the starting point for any initial or full-refresh builds. For example, a daily-grain microbatch model run on `2024-10-01` with `begin = '2023-10-01` will process 366 batches (it's a leap year!) plus the batch for "today." | N/A |
| `batch_size` | String (required) | The granularity of your batches. The default is `day` (and currently this is the only granularity supported). | `day` |
| `batch_size` | String (required) | The granularity of your batches. Supported values are `hour`, `day`, `month`, and `year` | N/A |
| `lookback` | Integer (optional) | Process X batches prior to the latest bookmark to capture late-arriving records. | `0` |

<Lightbox src="/img/docs/building-a-dbt-project/microbatch/event_time.png" title="The event_time column configures the real-world time of this record"/>
Expand Down
2 changes: 1 addition & 1 deletion website/docs/docs/build/incremental-models.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ Not specifying a `unique_key` will result in append-only behavior, which means d

The optional `unique_key` parameter specifies a field (or combination of fields) that defines the grain of your model. That is, the field(s) identify a single unique row. You can define `unique_key` in a configuration block at the top of your model, and it can be a single column name or a list of column names.

The `unique_key` should be supplied in your model definition as a string representing a single column or a list of single-quoted column names that can be used together, for example, `['col1', 'col2', …])`. Columns used in this way should not contain any nulls, or the incremental model run may fail. Either ensure that each column has no nulls (for example with `coalesce(COLUMN_NAME, 'VALUE_IF_NULL')`), or define a single-column [surrogate key](https://www.getdbt.com/blog/guide-to-surrogate-key) (for example with [`dbt_utils.generate_surrogate_key`](https://github.com/dbt-labs/dbt-utils#generate_surrogate_key-source)).
The `unique_key` should be supplied in your model definition as a string representing a single column or a list of single-quoted column names that can be used together, for example, `['col1', 'col2', …])`. Columns used in this way should not contain any nulls, or the incremental model may fail to match rows and generate duplicate rows. Either ensure that each column has no nulls (for example with `coalesce(COLUMN_NAME, 'VALUE_IF_NULL')`) or define a single-column [surrogate key](https://www.getdbt.com/blog/guide-to-surrogate-key) (for example with [`dbt_utils.generate_surrogate_key`](https://github.com/dbt-labs/dbt-utils#generate_surrogate_key-source)).

:::tip
In cases where you need multiple columns in combination to uniquely identify each row, we recommend you pass these columns as a list (`unique_key = ['user_id', 'session_number']`), rather than a string expression (`unique_key = 'concat(user_id, session_number)'`).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,6 @@ You can read more about each of these behavior changes in the following links:
We also made some quality-of-life improvements in Core 1.9, enabling you to:

- Maintain data quality now that dbt returns an an error (versioned models) or warning (unversioned models) when someone [removes a contracted model by deleting, renaming, or disabling](/docs/collaborate/govern/model-contracts#how-are-breaking-changes-handled) it.
- Document [singular data tests](/docs/build/data-tests#document-singular-tests).
- Document [singular data tests](/docs/build/data-tests#singular-data-tests).
- Use `ref` and `source` in [foreign key constraints](/reference/resource-properties/constraints).
- Use `dbt test` with the `--resource-type` / `--exclude-resource-type` flag, making it possible to include or exclude data tests (`test`) or unit tests (`unit_test`).
16 changes: 7 additions & 9 deletions website/docs/reference/resource-configs/bigquery-configs.md
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ If your model has `partition_by` configured, you may optionally specify two addi

</File>

### Clustering Clause
### Clustering clause

BigQuery tables can be [clustered](https://cloud.google.com/bigquery/docs/clustered-tables) to colocate related data.

Expand All @@ -286,7 +286,7 @@ select * from ...

</File>

Clustering on a multiple columns:
Clustering on multiple columns:

<File name='bigquery_table.sql'>

Expand All @@ -303,11 +303,11 @@ select * from ...

</File>

## Managing KMS Encryption
## Managing KMS encryption

[Customer managed encryption keys](https://cloud.google.com/bigquery/docs/customer-managed-encryption) can be configured for BigQuery tables using the `kms_key_name` model configuration.

### Using KMS Encryption
### Using KMS encryption

To specify the KMS key name for a model (or a group of models), use the `kms_key_name` model configuration. The following example sets the `kms_key_name` for all of the models in the `encrypted/` directory of your dbt project.

Expand All @@ -328,7 +328,7 @@ models:
</File>
## Labels and Tags
## Labels and tags
### Specifying labels
Expand Down Expand Up @@ -373,8 +373,6 @@ models:

</File>



<Lightbox src="/img/docs/building-a-dbt-project/building-models/73eaa8a-Screen_Shot_2020-01-20_at_12.12.54_PM.png" title="Viewing labels in the BigQuery console"/>

### Specifying tags
Expand Down Expand Up @@ -434,7 +432,7 @@ The `incremental_strategy` config can be set to one of two values:
### Performance and cost

The operations performed by dbt while building a BigQuery incremental model can
be made cheaper and faster by using [clustering keys](#clustering-keys) in your
be made cheaper and faster by using a [clustering clause](#clustering-clause) in your
model configuration. See [this guide](https://discourse.getdbt.com/t/benchmarking-incremental-strategies-on-bigquery/981) for more information on performance tuning for BigQuery incremental models.

**Note:** These performance and cost benefits are applicable to incremental models
Expand Down Expand Up @@ -673,7 +671,7 @@ select ...

</File>

## Authorized Views
## Authorized views

If the `grant_access_to` config is specified for a model materialized as a
view, dbt will grant the view model access to select from the list of datasets
Expand Down
176 changes: 0 additions & 176 deletions website/src/pages/styles.js

This file was deleted.

5 changes: 5 additions & 0 deletions website/vercel.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
"cleanUrls": true,
"trailingSlash": false,
"redirects": [
{
"source": "/styles",
"destination": "https://github.com/dbt-labs/docs.getdbt.com/blob/current/contributing/adding-page-components.md",
"permanent": true
},
{
"source": "/docs/dbt-cloud-apis/sl-manifest",
"destination": "/reference/artifacts/sl-manifest",
Expand Down

0 comments on commit bc0ad6a

Please sign in to comment.