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

Model contract: raise warning if numeric data type without specified precision/scale #4251

Closed
FishtownBuildBot opened this issue Oct 11, 2023 · 0 comments · Fixed by #4255 or #4258
Closed
Assignees
Labels
content Improvements or additions to content dbt Core The changes proposed in this issue relate to dbt Core improvement Use this when an area of the docs needs improvement as it's currently unclear

Comments

@FishtownBuildBot
Copy link

FishtownBuildBot commented Oct 11, 2023

https://docs.getdbt.com/reference/resource-configs/contract

Let's update this paragraph:

That said, on certain data platforms, you will need to specify a varchar size or numeric scale if you do not want it to revert to the default. This is most relevant for the numeric type on Snowflake, which defaults to a precision of 38 and a scale of 0 (zero digits after the decimal, such as rounded to an integer). To avoid this implicit coercion, specify your data_type with a nonzero scale, like numeric(38, 6).

To make clear that:

  • This isn't just on Snowflake
  • Starting in v1.7, dbt will raise a warning
@runleonarun runleonarun added content Improvements or additions to content improvement Use this when an area of the docs needs improvement as it's currently unclear dbt Core The changes proposed in this issue relate to dbt Core labels Oct 11, 2023
@jtcohen6 jtcohen6 changed the title Docs Changes Needed from dbt-core PR #8721 Model contract: raise warning if numeric data type without specified precision/scale Oct 11, 2023
@runleonarun runleonarun self-assigned this Oct 11, 2023
matthewshaver added a commit that referenced this issue Oct 11, 2023
closes #4251

## What are you changing in this pull request and why?

Adding more context and that core includes an error for 1.7 and higher.

## Checklist
<!--
Uncomment if you're publishing docs for a prerelease version of dbt
(delete if not applicable):
- [ ] Add versioning components, as described in [Versioning
Docs](https://github.com/dbt-labs/docs.getdbt.com/blob/current/contributing/single-sourcing-content.md#versioning-entire-pages)
- [ ] Add a note to the prerelease version [Migration
Guide](https://github.com/dbt-labs/docs.getdbt.com/tree/current/website/docs/guides/migration/versions)
-->
- [ ] Review the [Content style
guide](https://github.com/dbt-labs/docs.getdbt.com/blob/current/contributing/content-style-guide.md)
and [About
versioning](https://github.com/dbt-labs/docs.getdbt.com/blob/current/contributing/single-sourcing-content.md#adding-a-new-version)
so my content adheres to these guidelines.
- [ ] Add a checklist item for anything that needs to happen before this
PR is merged, such as "needs technical review" or "change base branch."

Adding new pages (delete if not applicable):
- [ ] Add page to `website/sidebars.js`
- [ ] Provide a unique filename for the new page

Removing or renaming existing pages (delete if not applicable):
- [ ] Remove page from `website/sidebars.js`
- [ ] Add an entry `website/static/_redirects`
- [ ] [Ran link
testing](https://github.com/dbt-labs/docs.getdbt.com#running-the-cypress-tests-locally)
to update the links that point to the deleted page
runleonarun added a commit that referenced this issue Oct 11, 2023
…view) (#4258)

closes #4251

Captures this Core change:
dbt-labs/dbt-core#8721

This PR adds more context for rules, adds an example, and notes that
core includes an error for 1.7 and higher.

Note: This PR reverts #4257 which reverted
#4255

---------

Co-authored-by: Emily Rockman <emily.rockman@dbtlabs.com>
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 dbt Core The changes proposed in this issue relate to dbt Core improvement Use this when an area of the docs needs improvement as it's currently unclear
Projects
None yet
2 participants