-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* consolidate timestamps * add changie and update reqs * fix whitespace * fix utc macro * Update Under the Hood-20220926-101606.yaml * fix base test class import * add backcompat to fixture * add utc backcompat * remove cruft in timestamps * add backcompat back * remove duplicate snapshot macro * whitespace fix * fix backcompat macro * add redshift__current_timestamp_backcompat * fix test naming and import * fix base test class import * update dev-requirements * Update change log body
- Loading branch information
1 parent
8ff1c9e
commit 717018a
Showing
4 changed files
with
47 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
kind: Features | ||
body: Migrate dbt-utils current_timestamp macros into core + adapters | ||
time: 2022-09-26T10:16:06.676737-07:00 | ||
custom: | ||
Author: colin-rogers-dbt | ||
Issue: "194" | ||
PR: "191" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{% macro redshift__current_timestamp() -%} | ||
getdate() | ||
{%- endmacro %} | ||
|
||
{% macro redshift__snapshot_get_time() -%} | ||
{{ current_timestamp() }}::timestamp | ||
{%- endmacro %} | ||
|
||
{% macro redshift__snapshot_string_as_time(timestamp) -%} | ||
{%- set result = "'" ~ timestamp ~ "'::timestamp" -%} | ||
{{ return(result) }} | ||
{%- endmacro %} | ||
|
||
{% macro redshift__current_timestamp_backcompat() -%} | ||
getdate() | ||
{%- endmacro %} | ||
|
||
{% macro redshift__current_timestamp_in_utc_backcompat() -%} | ||
getdate() | ||
{%- endmacro %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import pytest | ||
from dbt.tests.adapter.utils.test_timestamps import BaseCurrentTimestamps | ||
|
||
|
||
class TestCurrentTimestampRedshift(BaseCurrentTimestamps): | ||
@pytest.fixture(scope="class") | ||
def expected_schema(self): | ||
return { | ||
"current_timestamp": "timestamp without time zone", | ||
"current_timestamp_in_utc_backcompat": "timestamp without time zone", | ||
"current_timestamp_backcompat": "timestamp without time zone", | ||
} | ||
|
||
@pytest.fixture(scope="class") | ||
def expected_sql(self): | ||
return """ | ||
select getdate() as current_timestamp, | ||
getdate() as current_timestamp_in_utc_backcompat, | ||
getdate() as current_timestamp_backcompat | ||
""" |