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

Preserve decimal places for dbt show #8561

Merged
merged 6 commits into from
Sep 7, 2023
Merged

Preserve decimal places for dbt show #8561

merged 6 commits into from
Sep 7, 2023

Conversation

emmyoop
Copy link
Member

@emmyoop emmyoop commented Sep 6, 2023

resolves #8153
docs dbt-labs/docs.getdbt.com/#

Problem

Agate tables, which power dbt show, and therefore the dbt cloud IDE, show integer values as decimals, leading to user confusion when columns seem to have decimals when they don't! this overrides that behavior in the dbt-core customization of the agate Number class

Solution

Ensure that the Number.cast() and Number.jsonify() methods properly handle integer values.
Also ensure it handles table merges appropriately.

Checklist

  • I have read the contributing guide and understand what's expected of me
  • I have run this code in development and it appears to resolve the stated issue
  • This PR includes tests, or tests are not required/relevant for this PR
  • This PR has no interface changes (e.g. macros, cli, logs, json artifacts, config files, adapter interface, etc) or this PR has already received feedback and approval from Product or DX

dave-connors-3 and others added 2 commits September 5, 2023 19:46
* add show test for json data

* oh changie my changie

* revert unecessary cahnge to fixture

* keep decimal class for precision methods, but return __int__ value

* jerco updates

* update integer type

* update other tests

* Update .changes/unreleased/Fixes-20230803-093502.yaml

---------

Co-authored-by: Emily Rockman <[email protected]>
@cla-bot cla-bot bot added the cla:yes label Sep 6, 2023
@codecov
Copy link

codecov bot commented Sep 6, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: -0.05% ⚠️

Comparison is base (7e2a08f) 86.41% compared to head (da21bef) 86.37%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8561      +/-   ##
==========================================
- Coverage   86.41%   86.37%   -0.05%     
==========================================
  Files         174      174              
  Lines       25587    25598      +11     
==========================================
- Hits        22112    22110       -2     
- Misses       3475     3488      +13     
Flag Coverage Δ
integration 83.16% <83.33%> (-0.13%) ⬇️
unit 65.06% <91.66%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
core/dbt/clients/agate_helper.py 97.61% <100.00%> (+1.09%) ⬆️

... and 4 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@emmyoop emmyoop changed the title Er/retry numbers Preserve decimal places for dbt show Sep 6, 2023
@emmyoop emmyoop marked this pull request as ready for review September 6, 2023 17:31
@emmyoop emmyoop requested a review from a team as a code owner September 6, 2023 17:31
@emmyoop emmyoop requested a review from MichelleArk September 6, 2023 17:31
@emmyoop emmyoop merged commit be94bf1 into main Sep 7, 2023
49 of 50 checks passed
@emmyoop emmyoop deleted the er/retry-numbers branch September 7, 2023 14:15
github-actions bot pushed a commit that referenced this pull request Sep 7, 2023
* update `Number` class to handle integer values (#8306)

* add show test for json data

* oh changie my changie

* revert unecessary cahnge to fixture

* keep decimal class for precision methods, but return __int__ value

* jerco updates

* update integer type

* update other tests

* Update .changes/unreleased/Fixes-20230803-093502.yaml

---------

Co-authored-by: Emily Rockman <[email protected]>

* account for integer vs number on table merges

* add tests for combining number with integer.

* add unit test when nulls are added

* cant none as an Integer

* fix null tests

---------

Co-authored-by: dave-connors-3 <[email protected]>
Co-authored-by: Dave Connors <[email protected]>
(cherry picked from commit be94bf1)
emmyoop added a commit that referenced this pull request Sep 7, 2023
* update `Number` class to handle integer values (#8306)

* add show test for json data

* oh changie my changie

* revert unecessary cahnge to fixture

* keep decimal class for precision methods, but return __int__ value

* jerco updates

* update integer type

* update other tests

* Update .changes/unreleased/Fixes-20230803-093502.yaml

---------

Co-authored-by: Emily Rockman <[email protected]>

* account for integer vs number on table merges

* add tests for combining number with integer.

* add unit test when nulls are added

* cant none as an Integer

* fix null tests

---------

Co-authored-by: dave-connors-3 <[email protected]>
Co-authored-by: Dave Connors <[email protected]>
(cherry picked from commit be94bf1)

Co-authored-by: Emily Rockman <[email protected]>
emmyoop added a commit that referenced this pull request Sep 7, 2023
emmyoop added a commit that referenced this pull request Sep 7, 2023
emmyoop added a commit that referenced this pull request Sep 11, 2023
* update `Number` class to handle integer values (#8306)

* add show test for json data

* oh changie my changie

* revert unecessary cahnge to fixture

* keep decimal class for precision methods, but return __int__ value

* jerco updates

* update integer type

* update other tests

* Update .changes/unreleased/Fixes-20230803-093502.yaml

---------

Co-authored-by: Emily Rockman <[email protected]>

* account for integer vs number on table merges

* add tests for combining number with integer.

* add unit test when nulls are added

* cant none as an Integer

* fix null tests

---------

Co-authored-by: dave-connors-3 <[email protected]>
Co-authored-by: Dave Connors <[email protected]>
colin-rogers-dbt pushed a commit that referenced this pull request Sep 11, 2023
* update `Number` class to handle integer values (#8306)

* add show test for json data

* oh changie my changie

* revert unecessary cahnge to fixture

* keep decimal class for precision methods, but return __int__ value

* jerco updates

* update integer type

* update other tests

* Update .changes/unreleased/Fixes-20230803-093502.yaml

---------



* account for integer vs number on table merges

* add tests for combining number with integer.

* add unit test when nulls are added

* cant none as an Integer

* fix null tests

---------

Co-authored-by: dave-connors-3 <[email protected]>
Co-authored-by: Dave Connors <[email protected]>
@aranke aranke mentioned this pull request Jul 12, 2024
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[CT-2848] [Bug] dbt show adding decimal places to non-decimal values
3 participants