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

Cartesian Join Update #21

Closed
wants to merge 4 commits into from

Conversation

sisu-callum
Copy link
Contributor

Description

Based on this issue, I've added a parameter called cartesian_join that can be set to true or false1. The default value for this is true and it uses the current logic. If the parameter is set to false, it uses the logic raised in the issue and excludes impossible combinations of values.

Changes

  • get_metric_sql: This macro now has an additional if statement in the spine_values section. I'm unsure of what dbt_labs best practice is but I figured having the else statement correspond to the current logic was the safest practice2. Only if the cartesian_join parameter is set to false will it apply the other logic.
  • metric: Added the cartesian_join field and set default to true.

Tests

I'll be completely honest, I was not entirely sure how to test this outside of my repo with DWH connection. I am sure there is some way that all the package maintainers are aware of but I didn't want to bother @fivetran-joemarkiewicz over the weekend. So I copied over the logic into my repo and tested it there. It worked fine for me! 🤞 it passes all the other tests.

Footnotes

Footnotes

  1. To be honest, I'm not married to that name? I kept it 1:1 with the language used in the filed issue but I think there is probably a better way to name it for the average user. Maybe exclude_impossible_combinations and set the default value to false.

  2. See the beginning of the if statement current set to == false, which is not default

@cla-bot cla-bot bot added the cla:yes The CLA has been signed label Mar 7, 2022
@callum-mcdata
Copy link
Contributor

As the creator of this PR, I'm going to close it out and re-create one using best practices. Namely I won't be adding the parameter in the macro that allows for the cartesian join. I'll just be removing it outright

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla:yes The CLA has been signed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants