fivetran / dbt_stripe_source

Fivetran's Stripe source dbt package
https://fivetran.github.io/dbt_stripe_source/
Apache License 2.0
8 stars 27 forks source link

fix if statement subscription history #46

Closed paulavidela closed 2 years ago

paulavidela commented 2 years ago

Pull Request Are you a current Fivetran customer? Paula, Aleph, Data team

What change(s) does this PR introduce? Clause {% if var('stripe__subscription_history', false) %}was not working if database had 'subscription_history', change it to: {% if var('stripe__subscription_history') is not none %}

Did you update the CHANGELOG?

Does this PR introduce a breaking change?

Did you update the dbt_project.yml files with the version upgrade (please leverage standard semantic versioning)? (In both your main project and integration_tests)

Is this PR in response to a previously created Bug or Feature Request

How did you test the PR changes?

Select which warehouse(s) were used to test the PR

Provide an emoji that best describes your current mood

:dancer: **Feedback** We are so excited you decided to contribute to the Fivetran community dbt package! We continue to work to improve the packages and would greatly appreciate your [feedback](https://www.surveymonkey.com/r/DQ7K7WW) on our existing dbt packages or what you'd like to see next.
fivetran-joemarkiewicz commented 2 years ago

Hi @paulavidela thanks so much for opening this PR!

Looking further into this I am wondering why the original statement was not working 🤔. The logic should set the variable to false only if it is not declared. Are overwriting this by declaring the variable as true in your root dbt_project.yml?

paulavidela commented 2 years ago

Hi @paulavidela thanks so much for opening this PR!

Looking further into this I am wondering why the original statement was not working 🤔. The logic should set the variable to false only if it is not declared. Are overwriting this by declaring the variable as true in your root dbt_project.yml?

Thanks Joe @fivetran-joemarkiewicz ! in dbt_project @ dbt_stripe_source we have: subscription_history: "{{ source('stripe', 'subscription_history') }}" subscription: "{{ source('stripe', 'subscription') }}"

in dbt_project @ dbt_stripe we have: subscription: "{{ ref('stg_stripe__subscription') }}"

It was failing because we have the table 'subscription_history' but not 'subscription'

for some reason: even though we had the table _subscriptionhistory, subscription_history: "{{ source('stripe', 'subscription_history') }}" was not true so the model was looking for table subscription and failing We wanted the first statement to be true.

fivetran-joemarkiewicz commented 2 years ago

Thanks for the additional details @paulavidela!

In order for the package to disable the subscription source, you will need to add the stripe__subscription_history variable to your root dbt_project.yml and set the value to be true.

vars:
    stripe__subscription_history: True

Would you mind setting this in your project and let me know if you still experience and error within the package.

paulavidela commented 2 years ago

Thanks for the additional details @paulavidela!

In order for the package to disable the subscription source, you will need to add the stripe__subscription_history variable to your root dbt_project.yml and set the value to be true.

vars:
    stripe__subscription_history: True

Would you mind setting this in your project and let me know if you still experience and error within the package.

Thanks! Closing this PR