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

Use lead for end-date in spine + document empty opportunity table solution #48

Merged
merged 9 commits into from
Feb 20, 2024

Conversation

fivetran-jamie
Copy link
Contributor

@fivetran-jamie fivetran-jamie commented Feb 14, 2024

PR Overview

This PR will address the following Issue/Feature:
#47

This PR will result in the following new package version:

v1.0.1

Please detail what change(s) this PR introduces and any additional information that should be known during the review of this PR:

Bug Fix

  • Aligns the last_date_query logic in the int_salesforce__date_spine model with the first_date_query logic. This ensures that users with empty opportunity tables will have a valid end-date (based on lead instead of opportunity) for the salesforce__daily_activity end model.
    • Also adds coalesce-logic to int_salesforce__date_spine to ensure a succesful run without lead data.

Documentation

  • Documents how users without an opportunity table can still have the package run successfully for them. See README for details.

Under the Hood

  • Included auto-releaser GitHub Actions workflow to automate future releases.

PR Checklist

Basic Validation

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

  • dbt compile
  • dbt run –full-refresh
  • dbt run
  • dbt test
  • dbt run –vars (if applicable) -- specifically tested with salesforce__lead_enabled

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

  • The appropriate issue has been linked and tagged
  • You are assigned to the corresponding issue and this PR
  • BuildKite integration tests are passing

Detailed Validation

Please acknowledge that the following validation checks have been performed prior to marking this PR as "ready for review":

  • You have validated these changes and assure this PR will address the respective Issue/Feature.
  • You are reasonably confident these changes will not impact any other components of this package or any dependent packages.
  • You have provided details below around the validation steps performed to gain confidence in these changes.

Ran locally with lead_enabled turn off and on (off is essentially prod behavior).

Runs were successful and the row count did not change with our test data
image

i also did this with an empty opportunity table (i removed all records from the opportunity seed file and ran the package off the seed files)

Standard Updates

Please acknowledge that your PR contains the following standard updates:

  • Package versioning has been appropriately indexed in the following locations:
    • indexed within dbt_project.yml
    • indexed within integration_tests/dbt_project.yml
  • CHANGELOG has individual entries for each respective change in this PR
  • README updates have been applied (if applicable)
  • DECISIONLOG updates have been updated (if applicable)
  • Appropriate yml documentation has been added (if applicable)

dbt Docs

Please acknowledge that after the above were all completed the below were applied to your branch:

  • docs were regenerated (unless this PR does not include any code or yml updates)

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

🧷

@fivetran-jamie fivetran-jamie self-assigned this Feb 14, 2024
Copy link
Contributor

@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-jamie great job on this PR. I only have one small question, but other than that this looks good to go!

{% if var('salesforce__lead_enabled', True) %}
select max( created_date ) as max_date from {{ source('salesforce', 'lead') }}
{% else %}
select coalesce(max( created_date ), '2024-01-01') as max_date from {{ source('salesforce', 'opportunity') }}
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we consider changing the default to just be the current date instead of hard coding 2024-01-01

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah because of this line, we end up choosing the current date anyways!

but perhaps this whole snippet is ultimately kinda roundabout and unnecessary -- is the last_date ever going to be greater than the current date, or should we just automatically choose the current_date? changing it entirely might be venturing out of scope i suppose though

Copy link
Contributor

Choose a reason for hiding this comment

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

Ahh okay I see now. Yeah this is a bit roundabout and not entirely necessary. I think we can open a FR to clean up this logic in the future to make it more streamlined. I would agree that this is a bit out of scope for the final hours of the sprint.

This looks good to go!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

FR made! #49

@fivetran-jamie fivetran-jamie merged commit 169028f into main Feb 20, 2024
6 of 8 checks passed
@fivetran-jamie fivetran-jamie deleted the bug/use-lead-for-spine-end-date branch February 20, 2024 17:53
@fivetran-jamie fivetran-jamie restored the bug/use-lead-for-spine-end-date branch February 20, 2024 17:54
@fivetran-avinash fivetran-avinash self-requested a review February 20, 2024 22:01
Copy link
Contributor

@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.

lgtm

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.

3 participants