Skip to content

Commit 31577cb

Browse files
authored
Remove extraneous whitespace (#529)
* rm whitespace from date_trunc * datediff * rm uncessary whitespace control * change log * fix CHANGELOG * address comments
1 parent 839a4fc commit 31577cb

File tree

4 files changed

+15
-12
lines changed

4 files changed

+15
-12
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
- `star()` will only alias columns if a prefix/suffix is provided, to allow the unmodified output to still be used in `group by` clauses etc. [#468](https://github.com/dbt-labs/dbt-utils/pull/468)
2626
- The `sequential_values` test is now compatible with quoted columns [#479](https://github.com/dbt-labs/dbt-utils/pull/479)
2727
- `pivot()` escapes values containing apostrophes [#503](https://github.com/dbt-labs/dbt-utils/pull/503)
28+
- `date_trunc` and `datediff` default macros now have whitespace control to assist with linting and readability [#529](https://github.com/dbt-labs/dbt-utils/pull/529)
2829

2930
## Contributors:
3031
- [grahamwetzler](https://github.com/grahamwetzler) (#473)
@@ -34,6 +35,7 @@
3435
- [jelstongreen](https://github.com/jelstongreen) (#468)
3536
- [armandduijn](https://github.com/armandduijn) (#479)
3637
- [mdutoo](https://github.com/mdutoo) (#503)
38+
- [sunriselong](https://github.com/sunriselong) (#529)
3739

3840

3941
# dbt-utils v0.8.0

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ For compatibility details between versions of dbt-core and dbt-utils, [see this
6969
- [insert_by_period](#insert_by_period-source)
7070

7171
----
72+
=======
7273
### Generic Tests
7374
#### equal_rowcount ([source](macros/generic_tests/equal_rowcount.sql))
7475
Asserts that two relations have the same number of rows.

macros/cross_db_utils/date_trunc.sql

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
{{ return(adapter.dispatch('date_trunc', 'dbt_utils') (datepart, date)) }}
33
{%- endmacro %}
44

5-
{% macro default__date_trunc(datepart, date) %}
5+
{% macro default__date_trunc(datepart, date) -%}
66
date_trunc('{{datepart}}', {{date}})
7-
{% endmacro %}
7+
{%- endmacro %}
88

9-
{% macro bigquery__date_trunc(datepart, date) %}
9+
{% macro bigquery__date_trunc(datepart, date) -%}
1010
timestamp_trunc(
1111
cast({{date}} as timestamp),
1212
{{datepart}}
1313
)
1414

15-
{% endmacro %}
15+
{%- endmacro %}

macros/cross_db_utils/datediff.sql

+8-8
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,28 @@
33
{% endmacro %}
44

55

6-
{% macro default__datediff(first_date, second_date, datepart) %}
6+
{% macro default__datediff(first_date, second_date, datepart) -%}
77

88
datediff(
99
{{ datepart }},
1010
{{ first_date }},
1111
{{ second_date }}
1212
)
1313

14-
{% endmacro %}
14+
{%- endmacro %}
1515

1616

17-
{% macro bigquery__datediff(first_date, second_date, datepart) %}
17+
{% macro bigquery__datediff(first_date, second_date, datepart) -%}
1818

1919
datetime_diff(
2020
cast({{second_date}} as datetime),
2121
cast({{first_date}} as datetime),
2222
{{datepart}}
2323
)
2424

25-
{% endmacro %}
25+
{%- endmacro %}
2626

27-
{% macro postgres__datediff(first_date, second_date, datepart) %}
27+
{% macro postgres__datediff(first_date, second_date, datepart) -%}
2828

2929
{% if datepart == 'year' %}
3030
(date_part('year', ({{second_date}})::date) - date_part('year', ({{first_date}})::date))
@@ -55,12 +55,12 @@
5555
{{ exceptions.raise_compiler_error("Unsupported datepart for macro datediff in postgres: {!r}".format(datepart)) }}
5656
{% endif %}
5757

58-
{% endmacro %}
58+
{%- endmacro %}
5959

6060

6161
{# redshift should use default instead of postgres #}
62-
{% macro redshift__datediff(first_date, second_date, datepart) %}
62+
{% macro redshift__datediff(first_date, second_date, datepart) -%}
6363

6464
{{ return(dbt_utils.default__datediff(first_date, second_date, datepart)) }}
6565

66-
{% endmacro %}
66+
{%- endmacro %}

0 commit comments

Comments
 (0)