Skip to content

Commit 2a1e586

Browse files
colin-rogers-dbtelyoboalexmalinsjoellabes
authored
remove current_timestamp macro and obsolete functional tests (#694)
* Correct link from README to the CONTRIBUTING guide. (#687) * fix typo (#688) Co-authored-by: Alex Malins <[email protected]> * remove current_timestamp macro * add recency test back * fix recency * fix recency * update dev reqs * update dev reqs * fix recency.sql * fix recency * update dev-requirements * Fix copy paste error on TestTypeString * Remove specific branch reference for prerelease adapters * Delete obsolete functional tests * Remove functional test invocations from circle config * Remove references to retired macros in integration tests * Missed one * I msut save my files I must save my files I must save my files Co-authored-by: Liam O'Boyle <[email protected]> Co-authored-by: Alex Malins <[email protected]> Co-authored-by: Alex Malins <[email protected]> Co-authored-by: Joel Labes <[email protected]>
1 parent 369a2d0 commit 2a1e586

23 files changed

+24
-470
lines changed

.circleci/config.yml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@ jobs:
1919
steps:
2020
- checkout
2121
- run: pip install --pre dbt-postgres -r dev-requirements.txt
22-
- run:
23-
name: "Run Functional Tests - Postgres"
24-
command: ./run_functional_test.sh postgres
2522
- run:
2623
name: "Run OG Tests - Postgres"
2724
command: ./run_test.sh postgres
@@ -34,9 +31,6 @@ jobs:
3431
steps:
3532
- checkout
3633
- run: pip install --pre dbt-redshift -r dev-requirements.txt
37-
- run:
38-
name: "Run Functional Tests - Redshift"
39-
command: ./run_functional_test.sh redshift
4034
- run:
4135
name: "Run OG Tests - Redshift"
4236
command: ./run_test.sh redshift
@@ -49,9 +43,6 @@ jobs:
4943
steps:
5044
- checkout
5145
- run: pip install --pre dbt-snowflake -r dev-requirements.txt
52-
- run:
53-
name: "Run Functional Tests - Snowflake"
54-
command: ./run_functional_test.sh snowflake
5546
- run:
5647
name: "Run OG Tests - Snowflake"
5748
command: ./run_test.sh snowflake
@@ -69,9 +60,6 @@ jobs:
6960
- run:
7061
name: "Set up credentials"
7162
command: echo $BIGQUERY_SERVICE_ACCOUNT_JSON > ${HOME}/bigquery-service-key.json
72-
- run:
73-
name: "Run Functional Tests - BigQuery"
74-
command: ./run_functional_test.sh bigquery
7563
- run:
7664
name: "Run OG Tests - BigQuery"
7765
command: ./run_test.sh bigquery

README.md

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ Check [dbt Hub](https://hub.getdbt.com/dbt-labs/dbt_utils/latest/) for the lates
5555
- [get_url_path](#get_url_path-source)
5656

5757
- [Cross-database macros](#cross-database-macros):
58-
- [current_timestamp](#current_timestamp-source)
5958
- [dateadd](#dateadd-source)
6059
- [datediff](#datediff-source)
6160
- [split_part](#split_part-source)
@@ -1194,18 +1193,6 @@ Note that most of these macros moved to dbt Core as of dbt_utils v0.9.0 and dbt
11941193
To access the version defined in dbt Core, remove the `dbt_utils.` prefix (see [https://docs.getdbt.com/reference/dbt-jinja-functions/cross-database-macros](https://docs.getdbt.com/reference/dbt-jinja-functions/cross-database-macros) for examples).
11951194
As highlighted below, some of the cross-database macros are still in the process of being deprecated.
11961195

1197-
#### current_timestamp ([source](macros/cross_db_utils/current_timestamp.sql))
1198-
1199-
*DEPRECATED: This macro is deprecated and will be removed in a future version of the package, once equivalent functionality is implemented in dbt Core.*
1200-
1201-
This macro returns the current timestamp.
1202-
1203-
**Usage:**
1204-
1205-
```
1206-
{{ dbt_utils.current_timestamp() }}
1207-
```
1208-
12091196
#### dateadd ([source](macros/cross_db_utils/dateadd.sql))
12101197

12111198
*DEPRECATED: This macro is now provided in dbt Core. It is no longer available in dbt_utils and backwards compatibility will be removed in a future version of the package.*
@@ -1509,7 +1496,7 @@ A useful workaround is to change the above post-hook to:
15091496
### Reporting bugs and contributing code
15101497
15111498
- Want to report a bug or request a feature? Let us know in the `#package-ecosystem` channel on [Slack](http://community.getdbt.com/), or open [an issue](https://github.com/dbt-labs/dbt-utils/issues/new)
1512-
- Want to help us build dbt-utils? Check out the [Contributing Guide](https://github.com/dbt-utils/dbt-core/blob/HEAD/CONTRIBUTING.md)
1499+
- Want to help us build dbt-utils? Check out the [Contributing Guide](https://github.com/dbt-labs/dbt-utils/blob/main/CONTRIBUTING.md)
15131500
- **TL;DR** Open a Pull Request with 1) your changes, 2) updated documentation for the `README.md` file, and 3) a working integration test.
15141501

15151502
----

integration_tests/models/generic_tests/test_recency.sql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
select
55
1 as col1,
66
2 as col2,
7-
{{ dbt_utils.date_trunc('day', dbt_utils.current_timestamp()) }} as today
7+
{{ date_trunc('day', current_timestamp()) }} as today
88

99
{% else %}
1010

1111
select
1212
1 as col1,
1313
2 as col2,
14-
cast({{ dbt_utils.date_trunc('day', dbt_utils.current_timestamp()) }} as datetime) as today
14+
cast({{ date_trunc('day', current_timestamp()) }} as datetime) as today
1515

16-
{% endif %}
16+
{% endif %}

integration_tests/models/geo/test_haversine_distance_km.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ final as (
1313
lon2='lon_2',
1414
unit='km'
1515
)
16-
}} as {{ dbt_utils.type_numeric() }}
16+
}} as {{ type_numeric() }}
1717
) as actual
1818
from data
1919
)

integration_tests/models/geo/test_haversine_distance_mi.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ final as (
1313
lon2='lon_2',
1414
unit='mi'
1515
)
16-
}} as {{ dbt_utils.type_numeric() }}
16+
}} as {{ type_numeric() }}
1717
) as actual
1818
from data
1919

@@ -29,7 +29,7 @@ final as (
2929
lat2='lat_2',
3030
lon2='lon_2',
3131
)
32-
}} as {{ dbt_utils.type_numeric() }}
32+
}} as {{ type_numeric() }}
3333
) as actual
3434
from data
3535
)

integration_tests/models/sql/test_get_column_values.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ from {{ ref('data_get_column_values') }}
1919
select
2020
{% for val in column_values -%}
2121

22-
{{dbt_utils.safe_cast("sum(case when field = '" ~ val ~ "' then 1 else 0 end)", dbt_utils.type_string()) }} as count_{{ val }}
22+
{{ safe_cast("sum(case when field = '" ~ val ~ "' then 1 else 0 end)", type_string()) }} as count_{{ val }}
2323
{%- if not loop.last %},{% endif -%}
2424

2525
{%- endfor %}

integration_tests/models/sql/test_get_column_values_where.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22

33
-- Create a relation using the values
44
{% for val in column_values -%}
5-
select {{ dbt_utils.string_literal(val) }} as field {% if not loop.last %}union all{% endif %}
5+
select {{ string_literal(val) }} as field {% if not loop.last %}union all{% endif %}
66
{% endfor %}

integration_tests/models/sql/test_groupby.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ with test_data as (
22

33
select
44

5-
{{ dbt_utils.safe_cast("'a'", dbt_utils.type_string() )}} as column_1,
6-
{{ dbt_utils.safe_cast("'b'", dbt_utils.type_string() )}} as column_2
5+
{{ safe_cast("'a'", type_string() )}} as column_1,
6+
{{ safe_cast("'b'", type_string() )}} as column_2
77

88
),
99

integration_tests/models/sql/test_nullcheck_table.sql

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,16 @@ from nulled
2424

2525
select
2626

27-
{{ dbt_utils.safe_cast('field_1',
28-
dbt_utils.type_string()
27+
{{ safe_cast('field_1',
28+
type_string()
2929
)}} as field_1,
3030

31-
{{ dbt_utils.safe_cast('field_2',
32-
dbt_utils.type_string()
31+
{{ safe_cast('field_2',
32+
type_string()
3333
)}} as field_2,
3434

35-
{{ dbt_utils.safe_cast('field_3',
36-
dbt_utils.type_string()
35+
{{ safe_cast('field_3',
36+
type_string()
3737
)}} as field_3
3838

3939
from nulled

integration_tests/models/sql/test_unpivot.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ select
2424
from (
2525
{{ dbt_utils.unpivot(
2626
relation=ref('data_unpivot'),
27-
cast_to=dbt_utils.type_string(),
27+
cast_to=type_string(),
2828
exclude=exclude,
2929
remove=['name'],
3030
field_name='prop',

integration_tests/models/sql/test_unpivot_bool.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ select
2424
from (
2525
{{ dbt_utils.unpivot(
2626
relation=ref('data_unpivot_bool'),
27-
cast_to=dbt_utils.type_string(),
27+
cast_to=type_string(),
2828
exclude=exclude,
2929
field_name='prop',
3030
value_name='val'

integration_tests/tests/sql/test_get_column_values_use_default.sql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
{% set column_values = dbt_utils.get_column_values(ref('data_get_column_values_dropped'), 'field', default=['y', 'z'], order_by="field") %}
33

44
with expected as (
5-
select {{ dbt_utils.safe_cast("'y'", dbt_utils.type_string()) }} as expected_column_value union all
6-
select {{ dbt_utils.safe_cast("'z'", dbt_utils.type_string()) }} as expected_column_value
5+
select {{ safe_cast("'y'", type_string()) }} as expected_column_value union all
6+
select {{ safe_cast("'z'", type_string()) }} as expected_column_value
77
),
88

99
actual as (
1010

1111
{% for val in column_values %}
12-
select {{ dbt_utils.safe_cast("'" ~ val ~ "'", dbt_utils.type_string()) }} as actual_column_value
12+
select {{ safe_cast("'" ~ val ~ "'", type_string()) }} as actual_column_value
1313
{% if not loop.last %}
1414
union all
1515
{% endif %}

macros/cross_db_utils/current_timestamp.sql

Lines changed: 0 additions & 40 deletions
This file was deleted.

macros/generic_tests/mutually_exclusive_ranges.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ with window_functions as (
5656

5757
calc as (
5858
-- We want to return records where one of our assumptions fails, so we'll use
59-
-- the `not` function with `and` statements so we can write our assumptions nore cleanly
59+
-- the `not` function with `and` statements so we can write our assumptions more cleanly
6060
select
6161
*,
6262

macros/generic_tests/recency.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
{% macro default__test_recency(model, field, datepart, interval, group_by_columns) %}
66

7-
{% set threshold = dbt_utils.dateadd(datepart, interval * -1, dbt_utils.current_timestamp()) %}
7+
{% set threshold = dateadd(datepart, interval * -1, current_timestamp()) %}
88
{% if group_by_columns|length() > 0 %}
99
{% set select_gb_cols = group_by_columns|join(' ,') + ', ' %}
1010
{% set groupby_gb_cols = 'group by ' + group_by_columns|join(',') %}

0 commit comments

Comments
 (0)