-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Per the adapter maintainer upgrade guide for v1.6.0, this PR includes the following: Bugs fixed: - Fixed a bug causing the dateadd macro to fail its tests when handling DATETIME type fields. The updated sqlite__dateadd.sql macro now adequately handles both DATE and DATETIME types per ISO-8601 and passes its tests now. Changes made: [BtS] Adapter zone tests - Added four new tests in test_utils.py and all tests passed without overrides. No changes required: [BtS] Drop support for Py 3.7 - Support for Py 3.7 was already removed in dbt-sqlite 1.2.0rc1. [BtS] new arg for adapter.execute() - We use SQLConnectionManager.execute() directly. No changes required. No changes made: [FEATURE] Materialized Views: - Materialized views are not supported in sqlite3. No changes made. [FEATURE] dbt clone - Clone objects are not supported in sqlite3 because it is a simple in-process database. [BtS] revamp of dbt debug - No new warnings or errors in tests. No changes made. Possible remaining todo - Left out tests related to Contracts as they aren't being implemented as a feature. I had created a test and ran it only to see the test failed, which was expected, so the unit test needs to be overridden in order to make that passing criteria instead of failing.
- Loading branch information
1 parent
1bd64e4
commit 403e3f8
Showing
7 changed files
with
81 additions
and
11 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
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 |
---|---|---|
@@ -1 +1 @@ | ||
version = '1.5.0' | ||
version = '1.6.0' |
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 |
---|---|---|
@@ -1,8 +1,33 @@ | ||
{% macro sqlite__dateadd(datepart, interval, from_date_or_timestamp) %} | ||
-- If provided a DATETIME, returns a DATETIME | ||
-- If provided a DATE, returns a DATE | ||
|
||
date( | ||
{{ from_date_or_timestamp }}, | ||
"{{ datepart }} {{ datepart }}" | ||
) | ||
|
||
CASE | ||
-- 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') | ||
WHEN LOWER({{ datepart }}) = 'minute' THEN datetime({{ from_date_or_timestamp }}, '+' || {{ interval }} || ' minutes') | ||
WHEN LOWER({{ datepart }}) = 'hour' THEN datetime({{ from_date_or_timestamp }}, '+' || {{ interval }} || ' hours') | ||
WHEN LOWER({{ datepart }}) = 'day' THEN datetime({{ from_date_or_timestamp }}, '+' || {{ interval }} || ' days') | ||
WHEN LOWER({{ datepart }}) = 'week' THEN datetime({{ from_date_or_timestamp }}, '+' || ({{ interval }} * 7) || ' days') | ||
WHEN LOWER({{ datepart }}) = 'month' THEN datetime({{ from_date_or_timestamp }}, '+' || {{ interval }} || ' months') | ||
WHEN LOWER({{ datepart }}) = 'quarter' THEN datetime({{ from_date_or_timestamp }}, '+' || ({{ interval }} * 3) || ' months') | ||
WHEN LOWER({{ datepart }}) = 'year' THEN datetime({{ from_date_or_timestamp }}, '+' || {{ interval }} || ' years') | ||
ELSE NULL | ||
END | ||
-- 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 }}) | ||
WHEN LOWER({{ datepart }}) = 'day' THEN date({{ from_date_or_timestamp }}, '+' || {{ interval }} || ' days') | ||
WHEN LOWER({{ datepart }}) = 'week' THEN date({{ from_date_or_timestamp }}, '+' || ({{ interval }} * 7) || ' days') | ||
WHEN LOWER({{ datepart }}) = 'month' THEN date({{ from_date_or_timestamp }}, '+' || {{ interval }} || ' months') | ||
WHEN LOWER({{ datepart }}) = 'quarter' THEN date({{ from_date_or_timestamp }}, '+' || ({{ interval }} * 3) || ' months') | ||
WHEN LOWER({{ datepart }}) = 'year' THEN date({{ from_date_or_timestamp }}, '+' || {{ interval }} || ' years') | ||
ELSE NULL | ||
END | ||
ELSE | ||
NULL | ||
END | ||
{% 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
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