Skip to content

Commit

Permalink
Fix: Use timestamp macro in sequential values test for cross-db compa…
Browse files Browse the repository at this point in the history
…tibility (#376)

* pending: pending: #354

* some db's dont have `timestamp` type

* document

* Update CHANGELOG.md

Co-authored-by: Claire Carroll <[email protected]>
Co-authored-by: Claire Carroll <[email protected]>
  • Loading branch information
3 people authored Jun 1, 2021
1 parent 909f559 commit 00ebcb8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# dbt-utils v0.6.6

## Fixes

- make `sequential_values` schema test use `dbt_utils.type_timestamp()` to allow for compatibility with db's without timestamp data type. [#376](https://github.com/fishtown-analytics/dbt-utils/pull/376) from [@swanderz](https://github.com/swanderz)
# dbt-utils v0.6.5
## Features
* Add new `accepted_range` test ([#276](https://github.com/fishtown-analytics/dbt-utils/pull/276) [@joellabes](https://github.com/joellabes))
Expand Down
2 changes: 1 addition & 1 deletion macros/schema_tests/sequential_values.sql
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ validation_errors as (
*
from windowed
{% if datepart %}
where not(cast({{ column_name }} as timestamp)= cast({{ dbt_utils.dateadd(datepart, interval, 'previous_' + column_name) }} as timestamp))
where not(cast({{ column_name }} as {{ dbt_utils.type_timestamp() }})= cast({{ dbt_utils.dateadd(datepart, interval, 'previous_' + column_name) }} as {{ dbt_utils.type_timestamp() }}))
{% else %}
where not({{ column_name }} = previous_{{ column_name }} + {{ interval }})
{% endif %}
Expand Down

0 comments on commit 00ebcb8

Please sign in to comment.