-
Notifications
You must be signed in to change notification settings - Fork 41
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
Bug/null customer tags #89
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fivetran-catfritz this looks good to me! I do have one request to update the integrity test. Other than that, this code update looks good to go from my point of view! Thanks!
@@ -24,6 +24,5 @@ public_models: [ | |||
"shopify__products", | |||
"shopify__transactions", | |||
"shopify__customers", | |||
"shopify__order_lines", | |||
"shopify__line_item_enhanced" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for remembering to make this change!
select | ||
customer_id, | ||
count(*) as transform_customer_tag_count | ||
from {{ target.schema }}_shopify_dev.shopify__customers | ||
where customer_tags is not null | ||
group by 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This integrity test produces inaccurate results. This will count the number of tags in the source (accurate); however, it's only counting the number of rows for a given customer in the transform (inaccurate since this should always be 1). Therefore, this will result in a failed test if a given customer has multiple tags associated with them.
Instead we can adjust the transformation component of this test to check the items in the array and then count those. This way if a customer has 3 tags in the source, then there should be 3 items in the customer_tags array in the transform.
select | |
customer_id, | |
count(*) as transform_customer_tag_count | |
from {{ target.schema }}_shopify_dev.shopify__customers | |
where customer_tags is not null | |
group by 1 | |
select | |
customer_id, | |
array_length(split(customer_tags, ',')) as transform_customer_tag_count -- Only BigQuery compatible for the time being | |
from zz_dbt_joe_shopify_dev.shopify__customers | |
where customer_tags is not null | |
group by customer_id, customer_tags |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you. I have updated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the review @fivetran-joemarkiewicz. I updated the test, so moving to release review.
select | ||
customer_id, | ||
count(*) as transform_customer_tag_count | ||
from {{ target.schema }}_shopify_dev.shopify__customers | ||
where customer_tags is not null | ||
group by 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you. I have updated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fivetran-catfritz lgtm!
PR Overview
This PR will address the following Issue/Feature:
This PR will result in the following new package version:
Please provide the finalized CHANGELOG entry which details the relevant changes included in this PR:
PR Checklist
Basic Validation
Please acknowledge that you have successfully performed the following commands locally:
dbt run (if incremental models are present) && dbt testBefore marking this PR as "ready for review" the following have been applied:
Detailed Validation
Please share any and all of your validation steps:
Simulated issue with seed data and confirm the update corrects this. See prod vs dev for customer_id '3584045351010'.
Newly added validation tests are:
If you had to summarize this PR in an emoji, which would it be?
💃