fivetran / dbt_stripe

Data models for Stripe built using dbt.
https://fivetran.github.io/dbt_stripe/
Apache License 2.0
29 stars 33 forks source link

[Feature Request] Adding timezone variable to cast datetime into specific timezones #12

Closed lordhumunguz closed 3 years ago

lordhumunguz commented 3 years ago

Context

Currently the stripe data is ingested as UTC and transformed as UTC as well (AFAIK), which causes the numbers to mismatch with the Stripe dashboard.

Proposal

Adding a new (optional) variable that will cast any DATETIME or DATE fields into a specific timezone. Eg. for stripe_customer_overview model, add a new field like: DATETIME(customer.created_at, '{{ var("timezone") }}') as created_at_tz.

That way, the original created_at datetime in UTC is still preserved, and the end user has the option to use created_at_tz for a localized timezone.

Similarly for stripe_daily_overview, adding date_tz columns for the WITH statements -- daily_balance_transactions and daily_failed_charges, as well as optionally joining on date_tz if a timezone var is present.

kristin-bagnall commented 3 years ago

@fadhguru thank you for creating this issue, and it was great meeting you earlier today.

We'll add this feature request to our backlog and let you know when this is implemented.

fivetran-joemarkiewicz commented 3 years ago

@fadhguru this has been adding to our recent v0.4.2 release of the dbt_stripe package!!

This release will most likely be live on the dbt hub by Monday morning. Closing this ticket as the feature request has been integrated into the package. Please feel free to reach back out or create a new ticket if you have any further questions or requests.