fivetran / dbt_stripe_source

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

Hardcoded `plan_interval` in `stg_stripe__plan` for BigQuery removes actual data #9

Closed lordhumunguz closed 3 years ago

lordhumunguz commented 3 years ago

Hi there,

In the stg_stripe__plan model, any reason we need this bit?

Here's the direct link to the code

{% if target.type == 'bigquery' %}
    'interval' as plan_interval,
{% else %}
    interval as plan_interval,
{% endif %}

The issue with the above is I no longer have ability to see the ACTUAL interval of the plan. Instead it's just a blanket interval constant, making plan_interval useless.

Is there a particular issue this only happens for BigQuery?

fivetran-joemarkiewicz commented 3 years ago

Hi @fadhguru thank you for opening this issue! The sql snippet you provided above is intentional as interval is a reserved word within BigQuery and cannot explicitly be called within a select statement. That is why we use the conditional block to handle this reserved word.

However, it should not be hard coding "interval" as the value of the field. I looked into this and noticed interval was enclosed with single quotes ('), opposed to the correct back-tick (`). I updated this and found the hard code of this field to be fixed. I have since opened PR #10 to address this bug. We will keep you updated when the PR is merged and a new release is live.

fivetran-joemarkiewicz commented 3 years ago

Hi @fadhguru this bug fix has been implemented and is now lice within release v0.3.1 of our stripe_source package! You're stripe transform package should automatically update the source version if you rerun dbt deps.