Skip to content
This repository was archived by the owner on Sep 2, 2025. It is now read-only.

Commit 7b9ad3c

Browse files
consolidate timestamp macros (#480) (#495)
* add mypy ignore to column, connections and init * consolidate timestamp macros * add changie * Update Features-20220926-123609.yaml * add backcompat to test fixture * remove current_timestamp_in_utc * add expected_sql * remove backcompat from test_timestamps.py * update dev-requirements * Update change log body * lower case timestamps (cherry picked from commit b65e4f3) Co-authored-by: colin-rogers-dbt <[email protected]>
1 parent 4b5b8d9 commit 7b9ad3c

File tree

4 files changed

+28
-4
lines changed

4 files changed

+28
-4
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
kind: Features
2+
body: Migrate dbt-utils current_timestamp macros into core + adapters
3+
time: 2022-09-26T12:36:09.319981-07:00
4+
custom:
5+
Author: colin-rogers-dbt
6+
Issue: "483"
7+
PR: "480"

dbt/include/spark/macros/adapters.sql

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -209,10 +209,6 @@
209209
{{ return(load_result('list_schemas').table) }}
210210
{% endmacro %}
211211

212-
{% macro spark__current_timestamp() -%}
213-
current_timestamp()
214-
{%- endmacro %}
215-
216212
{% macro spark__rename_relation(from_relation, to_relation) -%}
217213
{% call statement('rename_relation') -%}
218214
{% if not from_relation.type %}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{% macro spark__current_timestamp() -%}
2+
current_timestamp()
3+
{%- endmacro %}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import pytest
2+
from dbt.tests.adapter.utils.test_timestamps import BaseCurrentTimestamps
3+
4+
5+
class TestCurrentTimestampSpark(BaseCurrentTimestamps):
6+
@pytest.fixture(scope="class")
7+
def models(self):
8+
return {"get_current_timestamp.sql": "select {{ current_timestamp() }} as current_timestamp"}
9+
10+
@pytest.fixture(scope="class")
11+
def expected_schema(self):
12+
return {
13+
"current_timestamp": "timestamp"
14+
}
15+
16+
@pytest.fixture(scope="class")
17+
def expected_sql(self):
18+
return """select current_timestamp() as current_timestamp"""

0 commit comments

Comments
 (0)