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 Model contracts section #3305

Merged
merged 2 commits into from
May 5, 2023

Conversation

damian3031
Copy link
Contributor

Added Model contracts section in Trino configuration docs.

@damian3031 damian3031 requested review from a team and dataders as code owners April 28, 2023 18:35
@netlify
Copy link

netlify bot commented Apr 28, 2023

Deploy Preview for docs-getdbt-com ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 9a5edcd
🔍 Latest deploy log https://app.netlify.com/sites/docs-getdbt-com/deploys/645515b8d8edc500072dae6d
😎 Deploy Preview https://deploy-preview-3305--docs-getdbt-com.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@github-actions github-actions bot added content Improvements or additions to content size: x-small This change will take under 3 hours to fix. labels Apr 28, 2023
@mirnawong1 mirnawong1 enabled auto-merge May 3, 2023 10:32
dataders
dataders previously approved these changes May 4, 2023
Copy link
Contributor

@dataders dataders left a comment

Choose a reason for hiding this comment

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

looks good! @nghi-ly would love your eyes on this if you get a chance

Copy link
Contributor

@nghi-ly nghi-ly left a comment

Choose a reason for hiding this comment

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

thank you so much for adding this section, @damian3031 ! appreciate your contribution! left a couple small suggs

@@ -365,3 +365,7 @@ models:
```
</File>

## Model contracts

The `dbt-trino` adapter supports [Model contracts](/docs/collaborate/govern/model-contracts). However, currently only `not_null` [constraint](/reference/resource-properties/constraints) is supported.
Copy link
Contributor

@nghi-ly nghi-ly May 4, 2023

Choose a reason for hiding this comment

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

small sugg for a better clarity.

Suggested change
The `dbt-trino` adapter supports [Model contracts](/docs/collaborate/govern/model-contracts). However, currently only `not_null` [constraint](/reference/resource-properties/constraints) is supported.
The `dbt-trino` adapter supports [model contracts](/docs/collaborate/govern/model-contracts). Currently, only [constraints](/reference/resource-properties/constraints) with `type` as `not_null` are supported.

## Model contracts

The `dbt-trino` adapter supports [Model contracts](/docs/collaborate/govern/model-contracts). However, currently only `not_null` [constraint](/reference/resource-properties/constraints) is supported.
Please ensure that underlying connector supports `not null`, before using this constraint in your model.
Copy link
Contributor

@nghi-ly nghi-ly May 4, 2023

Choose a reason for hiding this comment

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

Suggested change
Please ensure that underlying connector supports `not null`, before using this constraint in your model.
Before using a constraint in your model, make sure the underlying connector supports `not_null`.

Copy link
Contributor

Choose a reason for hiding this comment

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

curious, what happens if it doesn't? what sort of issues will the user encounter if they do end up using it? it's good practice to inform people why they should do a thing as it helps with learning.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

While trying not_null constraint on connector which doesn't support it, user will receive Trino error at dbt run stage, e.g.:
Hive tables do not support NOT NULL columns
Should I add detailed description in docs what would happen then? I think that it is not necessary in this case, as making sure that you use supported feature is self explanatory IMHO - you can't use feature, which is not supported 🙂
WDYT?

auto-merge was automatically disabled May 4, 2023 18:27

Head branch was pushed to by a user without write access

@damian3031 damian3031 force-pushed the add-model-contracts-section branch 2 times, most recently from 7ed3b70 to 8682d1b Compare May 4, 2023 18:28
Copy link
Contributor

@nghi-ly nghi-ly left a comment

Choose a reason for hiding this comment

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

updated the sentence in question. lemme know what you think!

## Model contracts

The `dbt-trino` adapter supports [model contracts](/docs/collaborate/govern/model-contracts). Currently, only [constraints](/reference/resource-properties/constraints) with `type` as `not_null` are supported.
Before using `not_null` constraint in your model, make sure the underlying connector supports `not null`.
Copy link
Contributor

Choose a reason for hiding this comment

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

you're right, @damian3031 , that would be too much. how about this or something similar?

Suggested change
Before using `not_null` constraint in your model, make sure the underlying connector supports `not null`.
Before using `not_null` constraints in your model, make sure the underlying connector supports `not null` to avoid running into errors.```

Copy link
Contributor Author

Choose a reason for hiding this comment

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

adjusted, thanks!

@damian3031 damian3031 force-pushed the add-model-contracts-section branch from 8682d1b to 1751879 Compare May 5, 2023 09:25
@nghi-ly nghi-ly enabled auto-merge May 5, 2023 14:42
@nghi-ly nghi-ly merged commit f302d4c into dbt-labs:current May 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
content Improvements or additions to content size: x-small This change will take under 3 hours to fix.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants