diff --git a/Dockerfile b/Dockerfile index cdb3813..841fed5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,7 +8,7 @@ RUN apt-get update && apt-get -y install git python3 python3-pip python3-venv sq WORKDIR /opt/dbt-sqlite RUN python3 -m pip install --upgrade pip \ - && python3 -m pip install pytest pytest-dotenv dbt-core~=1.5.0 dbt-tests-adapter~=1.5.0 + && python3 -m pip install pytest pytest-dotenv dbt-core~=1.6.0 dbt-tests-adapter~=1.6.0 RUN wget -q https://github.com/nalgeon/sqlean/releases/download/0.15.2/crypto.so RUN wget -q https://github.com/nalgeon/sqlean/releases/download/0.15.2/math.so diff --git a/dbt/adapters/sqlite/__version__.py b/dbt/adapters/sqlite/__version__.py index 4139253..f7c7de2 100644 --- a/dbt/adapters/sqlite/__version__.py +++ b/dbt/adapters/sqlite/__version__.py @@ -1 +1 @@ -version = '1.5.0' +version = '1.6.0' diff --git a/dbt/include/sqlite/macros/utils/dateadd.sql b/dbt/include/sqlite/macros/utils/dateadd.sql index 332c07f..cbf3db2 100644 --- a/dbt/include/sqlite/macros/utils/dateadd.sql +++ b/dbt/include/sqlite/macros/utils/dateadd.sql @@ -1,8 +1,9 @@ {% macro sqlite__dateadd(from_date_or_timestamp, interval, datepart) %} + -- If provided a DATETIME, returns a DATETIME + -- If provided a DATE, returns a DATE - -- Perform date addition based on the detected input format using CASE statements with LIKE for string contains CASE - -- Check if format is DATETIME + -- Matches DATETIME type based on ISO-8601 WHEN {{ from_date_or_timestamp }} LIKE '%:%' OR ({{ from_date_or_timestamp }} LIKE '%T%' AND {{ from_date_or_timestamp }} LIKE '%Z%') THEN CASE WHEN LOWER({{ datepart }}) = 'second' THEN datetime({{ from_date_or_timestamp }}, '+' || {{ interval }} || ' seconds') @@ -15,7 +16,7 @@ WHEN LOWER({{ datepart }}) = 'year' THEN datetime({{ from_date_or_timestamp }}, '+' || {{ interval }} || ' years') ELSE NULL END - -- Check if format is DATE + -- Matches DATE type based on ISO-8601 WHEN {{ from_date_or_timestamp }} LIKE '%-%' AND {{ from_date_or_timestamp }} NOT LIKE '%T%' AND {{ from_date_or_timestamp }} NOT LIKE '% %' THEN CASE WHEN LOWER({{ datepart }}) IN ('second', 'minute', 'hour') THEN date({{ from_date_or_timestamp }}) diff --git a/setup.py b/setup.py index 29cd0ff..9edb95d 100644 --- a/setup.py +++ b/setup.py @@ -46,7 +46,7 @@ def _get_plugin_version(): ] }, install_requires=[ - "dbt-core~=1.5.0" + "dbt-core~=1.6.0" ], classifiers=[ 'Development Status :: 4 - Beta',