Skip to content

Commit

Permalink
fixing window whitespacing
Browse files Browse the repository at this point in the history
  • Loading branch information
callum-mcdata committed Jan 9, 2023
1 parent 00b90fe commit 6b6d55b
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion integration_tests/dbt_project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ version: "1.0.0"
config-version: 2

# This setting configures which "profile" dbt uses for this project.
profile: "dbt_metrics_integration_tests_postgres"
profile: "dbt_metrics_integration_tests_bigquery"

model-paths: ["models"]
analysis-paths: ["analyses"]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
select *
from
{{ metrics.calculate(metric('base_median_metric'),
dimensions=['had_discount'])
{{ metrics.calculate(metric('base_median_metric'))
}}
2 changes: 1 addition & 1 deletion macros/sql_gen/gen_calendar_table_join.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

{% macro default__gen_calendar_table_join(metric_dictionary, calendar_tbl) %}
left join {{calendar_tbl}} calendar_table
{%- if metric_dictionary.window is not none -%}
{%- if metric_dictionary.window is not none %}
on cast(base_model.{{metric_dictionary.timestamp}} as date) > dateadd({{metric_dictionary.window.period}}, -{{metric_dictionary.window.count}}, calendar_table.date_day)
and cast(base_model.{{metric_dictionary.timestamp}} as date) <= calendar_table.date_day
{%- else %}
Expand Down
2 changes: 2 additions & 0 deletions macros/sql_gen/gen_property_to_aggregate.sql
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
{% macro bigquery__property_to_aggregate_median(expression, grain, dimensions, calendar_dimensions) %}

percentile_cont({{expression }}, 0.5) over (
{% if grain or dimensions | length > 0 or calendar_dimensions | length > 0 -%}
partition by
{% if grain -%}
calendar_table.date_{{ grain }}
Expand All @@ -43,6 +44,7 @@
,calendar_table.{{ calendar_dim }}
{%- endif -%}
{%- endfor %}
{%- endif %}
) as property_to_aggregate

{%- endmacro -%}
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/calculation_methods/test_median.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ def test_base_median_metric_no_time_grain(self,project,):
- order_country
"""

# seeds/base_median_metric_no_time_grain__expected.csv
# seeds/base_median_metric_complicated_source_expected.csv
base_median_metric_complicated_source__expected_csv = """
date_month,base_median_metric_complicated_source
2022-01-01,3.34
Expand Down

0 comments on commit 6b6d55b

Please sign in to comment.