-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
[Spike+] can't unit test precision #9627
Comments
I have not found the exact cause but was able to narrow it down more. It's actually using the precision from the sql when the cents get converted to dollars. When I set the column type to be With the By the time we generate the agate tables for comparison of the dollar fields here the values are already incorrect and have been rounded. My hunch is the problem is in the get_fixture_sql macro. With postgres, I used stg_payments model
My yaml
my seed for my payments source
|
I think it would likely be in get_expected_sql, since that applies casting to the 'expected' structure based on the sql of the model being tested. I think there are a couple ways we can approach a fix here:
|
Closing for implementation ticket #9884 |
Opened a new issue in dbt-labs/docs.getdbt.com: dbt-labs/docs.getdbt.com#5254 |
Is this a new bug in dbt-core?
Current Behavior
I have a
stg_payments
model:I create a unit test to make sure my amount field is doing the proper conversion / rounding:
This passes successfully even though
0.3333
is not technically equivalent to0.33
.Which is surprising given:
Essentially what’s happening is dbt is converting
0.3333
to the output data type (?) to execute the unit test, so0.33
=0.33
:Expected Behavior
My unit test should fail because
0.33
does not equal0.3333
.Time boxed spike to see if we can do this. If we can, let's complete the work with the spike.
Steps To Reproduce
See above
Relevant log output
No response
Environment
Which database adapter are you using with dbt?
snowflake (not unique to snowflake)
Additional Context
No response
The text was updated successfully, but these errors were encountered: