-
Notifications
You must be signed in to change notification settings - Fork 27
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/renamed-columns-datespine #56
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,11 @@ | ||
{% if var('salesforce__lead_enabled', True) -%} | ||
-- depends_on: {{ var('lead') }} | ||
{% else -%} | ||
-- depends_on: {{ var('opportunity') }} | ||
{% endif %} | ||
Comment on lines
+1
to
+5
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is still necessary for |
||
with spine as ( | ||
|
||
{% if execute %} | ||
{% if execute and flags.WHICH in ('run', 'build') %} | ||
|
||
{%- set first_date_query %} | ||
select | ||
|
@@ -9,36 +14,40 @@ with spine as ( | |
cast({{ dbt.dateadd("month", -1, "current_date") }} as date) | ||
) as min_date | ||
{% if var('salesforce__lead_enabled', True) %} | ||
from {{ source('salesforce', 'lead') }} | ||
from {{ var('lead') }} | ||
{% else %} | ||
from {{ source('salesforce', 'opportunity') }} | ||
from {{ var('opportunity') }} | ||
{% endif %} | ||
{% endset -%} | ||
|
||
{%- set first_date = dbt_utils.get_single_value(first_date_query) %} | ||
|
||
{% set last_date_query %} | ||
select | ||
coalesce( | ||
greatest(max(cast(created_date as date)), cast(current_date as date)), | ||
cast(current_date as date) | ||
) as max_date | ||
{% if var('salesforce__lead_enabled', True) %} | ||
from {{ source('salesforce', 'lead') }} | ||
from {{ var('lead') }} | ||
{% else %} | ||
from {{ source('salesforce', 'opportunity') }} | ||
from {{ var('opportunity') }} | ||
{% endif %} | ||
{% endset -%} | ||
|
||
{%- set last_date = dbt_utils.get_single_value(last_date_query) %} | ||
|
||
{% else %} | ||
|
||
{% set first_date = 'dbt.dateadd("month", -1, "current_date")' %} | ||
{% set last_date = 'dbt.current_timestamp_backcompat()' %} | ||
{%- set first_date_query%} | ||
select cast({{ dbt.dateadd("month", -1, "current_date") }} as date) | ||
{% endset -%} | ||
|
||
{% set last_date_query %} | ||
select cast({{ dbt.current_timestamp_backcompat() }} as date) | ||
{% endset -%} | ||
|
||
{% endif %} | ||
|
||
{%- set first_date = dbt_utils.get_single_value(first_date_query) %} | ||
{%- set last_date = dbt_utils.get_single_value(last_date_query) %} | ||
|
||
{{ dbt_utils.date_spine( | ||
datepart="day", | ||
start_date="cast('" ~ first_date ~ "' as date)", | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you also add either another bullet here or an under the hood entry that now that model has a depends on statement and also leverages the flags.WHICH. More for our purposes so we know how this issue was addressed and some underlying impacts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated!