diff --git a/.changes/unreleased/Features-20240501-151902.yaml b/.changes/unreleased/Features-20240501-151902.yaml new file mode 100644 index 000000000..1522e9775 --- /dev/null +++ b/.changes/unreleased/Features-20240501-151902.yaml @@ -0,0 +1,6 @@ +kind: Features +body: Cross-database `date` macro +time: 2024-05-01T15:19:02.929676-06:00 +custom: + Author: dbeatty10 + Issue: 1221 diff --git a/dbt/include/bigquery/macros/utils/date.sql b/dbt/include/bigquery/macros/utils/date.sql new file mode 100644 index 000000000..0f3b85aca --- /dev/null +++ b/dbt/include/bigquery/macros/utils/date.sql @@ -0,0 +1,3 @@ +{% macro bigquery__date(year, month, day) -%} + date({{ year }}, {{ month }}, {{ day }}) +{%- endmacro %} diff --git a/tests/functional/adapter/utils/test_utils.py b/tests/functional/adapter/utils/test_utils.py index 58cecdc7e..7ad4bdd6e 100644 --- a/tests/functional/adapter/utils/test_utils.py +++ b/tests/functional/adapter/utils/test_utils.py @@ -11,6 +11,7 @@ from dbt.tests.adapter.utils.test_cast_bool_to_text import BaseCastBoolToText from dbt.tests.adapter.utils.test_concat import BaseConcat from dbt.tests.adapter.utils.test_current_timestamp import BaseCurrentTimestampAware +from dbt.tests.adapter.utils.test_date import BaseDate from dbt.tests.adapter.utils.test_dateadd import BaseDateAdd from dbt.tests.adapter.utils.test_datediff import BaseDateDiff from dbt.tests.adapter.utils.test_date_spine import BaseDateSpine @@ -117,6 +118,10 @@ class TestCurrentTimestamp(BaseCurrentTimestampAware): pass +class TestDate(BaseDate): + pass + + class TestDateAdd(BaseDateAdd): pass