Skip to content

Commit

Permalink
Merge pull request #26 from morsapaes/dbt-utils_deprecate
Browse files Browse the repository at this point in the history
Soft deprecate cross-DB macros
  • Loading branch information
morsapaes authored Nov 23, 2022
2 parents 7ae96b0 + 30beefb commit 73c71fd
Show file tree
Hide file tree
Showing 9 changed files with 72 additions and 14 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
submodules: true
- name: Setup
run: |
pip install dbt-materialize==1.0.3
pip install dbt-materialize==1.3.0
mkdir -p ~/.dbt
cat > ~/.dbt/profiles.yml <<EOF
config:
Expand Down Expand Up @@ -45,5 +45,5 @@ jobs:

services:
materialized:
image: materialize/materialized:v0.26.3
image: materialize/materialized:v0.26.5
ports: ["6875:6875"]
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# materialize-dbt-utils Changelog

## Unreleased

* Bump the minimum supported version of `dbt-materialize` to v1.3.0.

* Deprecate the `dateadd`, `datediff`, `last_day` macros. These macros have been
moved into dbt Core in [dbt-core #5298](https://github.com/dbt-labs/dbt-core/pull/5298),
and will be removed in a subsequent release.

## 0.5.0 - 2022-06-24

* Bump the minimum supported version of Materialize to v0.26.3.
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ following packages with [Materialize]:
## Installation

Requirements:
- [dbt-materialize](https://pypi.org/project/dbt-materialize/) v1.0.3+
- [Materialize](https://materialize.com/docs/install/) v0.26.3+
- [dbt-materialize](https://pypi.org/project/dbt-materialize/) v1.3.0+
- [Materialize](https://materialize.com/docs/install/) v0.26.5+

Install this package by adding the following to the `packages.yml` file in your
root dbt project:

```
packages:
- package: dbt-labs/dbt_utils
version: 0.8.0
version: 0.9.2
- package: MaterializeInc/materialize_dbt_utils
version: 0.5.0
```
Expand Down
4 changes: 2 additions & 2 deletions dbt_project.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'materialize_dbt_utils'
version: '0.4.0'
version: '0.5.0'
config-version: 2

require-dbt-version: ">=1.0.0"
require-dbt-version: [">=1.3.0", "<2.0.0"]
2 changes: 1 addition & 1 deletion integration_tests/dbt_project.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
name: 'materialize_dbt_utils_integration_tests'
version: '0.1.0'
version: '0.5.0'
config-version: 2
24 changes: 24 additions & 0 deletions integration_tests/dbt_utils/dbt_project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,18 @@ config-version: 2

profile: integration_tests

model-paths: ["models"]
analysis-paths: ["analysis"]
test-paths: ["tests"]
seed-paths: ["data"]
macro-paths: ["macros"]

target-path: "target" # directory which will store compiled SQL files
clean-targets: # directories to be removed by `dbt clean`
- "target"
- "dbt_modules"
- "dbt_packages"

dispatch:
- macro_namespace: dbt_utils
search_order: [materialize_dbt_utils, dbt_utils_integration_tests, dbt_utils]
Expand All @@ -18,3 +30,15 @@ models:
# Tested by test_recency_override.
test_recency:
+enabled: false

seeds:
dbt_utils_integration_tests:
sql:
data_get_column_values_dropped:
+enabled: false
schema_tests:
# TODO(morsapaes): Enable once materialize #15863 lands
data_test_mutually_exclusive_ranges_with_gaps:
+enabled: false
data_test_mutually_exclusive_ranges_with_gaps_zero_length:
+enabled: false
12 changes: 10 additions & 2 deletions macros/dbt_utils/dateadd.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
{% macro materialize__dateadd(datepart, interval, from_date_or_timestamp) %}
{{ return(dbt_utils.postgres__dateadd(datepart, interval, from_date_or_timestamp)) }}
{% endmacro %}
{{ exceptions.warn(
"""
The dateadd macro has been moved to dbt Core; use the macro directly.
dbt_utils.dateadd is deprecated and will be removed in a future release
of materialize-dbt-utils.
"""
)}}

{{ return(adapter.dispatch('dateadd','dbt')(datepart, interval, from_date_or_timestamp)) }}
{% endmacro %}
13 changes: 11 additions & 2 deletions macros/dbt_utils/datediff.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
{% macro materialize__datediff(first_date, second_date, datepart) %}
{{ return(dbt_utils.postgres__datediff(first_date, second_date, datepart)) }}
{% endmacro %}

{{ exceptions.warn(
"""
The datediff macro has been moved to dbt Core; use the macro directly.
dbt_utils.datediff is deprecated and will be removed in a future release
of materialize-dbt-utils.
"""
)}}

{{ return(adapter.dispatch('datediff','dbt')(first_date, second_date, datepart)) }}
{% endmacro %}
13 changes: 11 additions & 2 deletions macros/dbt_utils/last_day.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
{% macro materialize__last_day(date, date_part) %}
{{ return(dbt_utils.postgres__last_day(date, date_part)) }}
{% endmacro %}

{{ exceptions.warn(
"""
The last_day macro has been moved to dbt Core; use the macro directly.
dbt_utils.last_day is deprecated and will be removed in a future release
of materialize-dbt-utils.
"""
)}}

{{ return(adapter.dispatch('last_day','dbt')(date, date_part)) }}
{% endmacro %}

0 comments on commit 73c71fd

Please sign in to comment.