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

[Bug Fix] Fix the timestamp casting #17

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

fivetran-avinash
Copy link
Contributor

@fivetran-avinash fivetran-avinash commented Feb 10, 2025

PR Overview

This PR will address the following Issue/Feature: Internal ticket plus [#15]

This PR will result in the following new package version: v0.2.2

Please provide the finalized CHANGELOG entry which details the relevant changes included in this PR:

Bug Fixes

  • Leveraged the {{ dbt.type_timestamp() }} macro within the staging models for all timestamp fields. (#17)
    • This is needed as certain Redshift warehouses sync these fields as timestamp with time zone fields by default, causing compilation errors in downstream models in the dbt_zuora package. This macro safely removes timezone values from the UTC timestamps and ensures successful compilations of these models.
Models Field updates cast as timestamp
stg_zuora__account created_date, last_invoice_date, tax_exempt_effective_date, tax_exempt_expiration_date, updated_date
stg_zuora__amendment created_date, updated_date
stg_zuora__contact created_date, updated_date
stg_zuora__credit_balance_adjustment cancelled_on, created_date, updated_date
stg_zuora__invoice_item charge_date, created_date, updated_date
stg_zuora__invoice_payment created_date, updated_date
stg_zuora__invoice created_date, last_email_sent_date, posted_date, updated_date
stg_zuora__order created_date, updated_date
stg_zuora__payment_method created_date, last_failed_sale_transaction_date, last_transaction_date_time, updated_date
stg_zuora__payment cancelled_on, created_date, settled_on, submitted_on, updated_date
stg_zuora__product_rate_plan_charge created_date, updated_date
stg_zuora__product_rate_plan created_date, updated_date
stg_zuora__product created_date, updated_date
stg_zuora__rate_plan created_date, updated_date
stg_zuora__rate_plan_charge created_date, updated_date
stg_zuora__refund_invoice_payment created_date, updated_date
stg_zuora__refund cancelled_on, created_date, refund_transaction_time, settled_on, submitted_on, updated_date
stg_zuora__subscription cancelled_date, contract_acceptance_date, contract_effective_date, created_date, original_created_date, service_activation_date, subscription_end_date, subscription_start_date, term_end_date, term_start_date, updated_date
stg_zuora__taxation_item created_date, exchange_rate_date, tax_date, updated_date

Documentation

  • Corrected references to connectors and connections in the README. (#16)

PR Checklist

Basic Validation

Please acknowledge that you have successfully performed the following commands locally:

  • dbt run –full-refresh && dbt test
  • [NA] dbt run (if incremental models are present) && dbt test

Before marking this PR as "ready for review" the following have been applied:

  • [NA] The appropriate issue has been linked, tagged, and properly assigned
  • All necessary documentation and version upgrades have been applied
  • docs were regenerated (unless this PR does not include any code or yml updates)
  • BuildKite integration tests are passing
  • Detailed validation steps have been provided below

Detailed Validation

Please share any and all of your validation steps:

See corresponding transform PR + height ticket

If you had to summarize this PR in an emoji, which would it be?

⏲️

@fivetran-avinash fivetran-avinash self-assigned this Feb 10, 2025
@fivetran-avinash fivetran-avinash linked an issue Feb 11, 2025 that may be closed by this pull request
4 tasks
Copy link
Collaborator

@fivetran-joemarkiewicz fivetran-joemarkiewicz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fivetran-avinash, generally looking good but a small questions and some light change requests before pre-release approval

README.md Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
Comment on lines 56 to 57
cast(subscription_end_date as {{ dbt.type_timestamp() }}) as subscription_end_date,
cast(subscription_start_date as {{ dbt.type_timestamp() }}) as subscription_start_date,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we sure these are timestamps? When looking at live data in BQ they are showing as date 🤔

Copy link
Contributor Author

@fivetran-avinash fivetran-avinash Feb 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are not. I think I added them to fix the date/timestamp union error you were seeing in the line_item_enhanced model. But I'm going to remove these and keep the initial date format and only apply casting changes there.

Copy link
Contributor Author

@fivetran-avinash fivetran-avinash left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fivetran-joemarkiewicz Ready for re-review!

Copy link
Collaborator

@fivetran-joemarkiewicz fivetran-joemarkiewicz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fivetran-avinash thanks for these updates - this looks ready for pre-release!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Documentation] Move badges below H1 heading
2 participants