Skip to content

Commit 500d495

Browse files
authored
dbt 1.10 migration (#310)
### Summary Update dbt-dremio to v1.10, supporting sample mode. ### Description - Update to v1.10 and implemented sample mode - Some test fixes ### Test Results - Added `test_sample_mode.py` - All tests behave as expected ### Changelog - [x] Added a summary of what this PR accomplishes to CHANGELOG.md ### Related Issue #303
1 parent 5c60514 commit 500d495

File tree

13 files changed

+148
-22
lines changed

13 files changed

+148
-22
lines changed

.github/scripts/compare_test_failures.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ echo "Comparing actual test failures with expected failures from: $expected_fail
2121
shopt -s globstar
2222

2323
# Extract actual failures from test reports
24-
actual_failures=$(grep -E "(FAILED tests|ERROR tests)" reports/**/*.txt | awk '{print $2}' | sort)
24+
actual_failures=$(grep -E "(FAILED tests|ERROR tests)" reports/**/*.txt | awk '{print $2}' | sort -u)
2525

2626
# Read expected failures
2727
expected_failures=$(sort "$expected_failures_file")
@@ -49,7 +49,7 @@ if [ -n "$unexpected_failures" ]; then
4949
fi
5050

5151
if [ -n "$missing_failures" ]; then
52-
echo "::warning::Expected test failures that did not occur (they passed):"
52+
echo "⚠️ Expected test failures that did not occur (they passed):"
5353
echo "$missing_failures"
5454
exit_code=1
5555
fi

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ jobs:
112112
run: |
113113
mkdir reports/
114114
report_file="reports/${{ env.sanitized_test_dir }}.txt"
115-
pytest ${{ matrix.test_dir }} | tee $report_file
115+
pytest -s ${{ matrix.test_dir }} | tee $report_file
116116
exit ${PIPESTATUS[0]}
117117
118118
- name: Upload test report as artifact

CHANGELOG.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
1-
# dbt-dremio v1.9.1
1+
# dbt-dremio v1.10.0
22

33
## Changes
44

5-
- [#299](https://github.com/dremio/dbt-dremio/pull/299) Enhance persist_docs macro to wrap model and column metadata (including descriptions, tags and tests) into a Markdown wiki for Dremio.
5+
- Updated dbt-dremio to match dbt-core v1.10 with sample mode
6+
- Enhanced persist_docs macro to wrap model and column metadata (including descriptions, tags and tests) into a Markdown wiki for Dremio.
67
- Refactored CI
78
- Fixed tests for hooks and grants
89
- Added Dremio Enterprise Catalog tests
910

11+
## Features
12+
13+
- [#310](https://github.com/dremio/dbt-dremio/pull/310) Sample mode
14+
15+
## Dependency
16+
17+
- Upgraded dbt-core to 1.10.0 and dbt-tests-adapter to 1.16.0
18+
1019
# dbt-dremio v1.9.0
1120

1221
## Changes

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@ The `dbt-dremio` package contains all of the code enabling dbt to work with [Dre
1212

1313
The dbt-dremio package supports both Dremio Cloud and Dremio Software (versions 22.0 and later).
1414

15-
## dbt-dremio version 1.9.0
15+
## dbt-dremio version 1.10.0
1616

17-
Version 1.9.0 of the dbt-dremio adapter is compatible with dbt-core versions 1.9.*.
17+
Version 1.10.0 of the dbt-dremio adapter is compatible with dbt-core versions 1.10.*.
1818

1919
> Prior to version 1.1.0b, dbt-dremio was created and maintained by [Fabrice Etanchaud](https://github.com/fabrice-etanchaud) on [their GitHub repo](https://github.com/fabrice-etanchaud/dbt-dremio). Code for using Dremio REST APIs was originally authored by [Ryan Murray](https://github.com/rymurr). Contributors in this repo are credited for laying the groundwork and maintaining the adapter till version 1.0.6.5. The dbt-dremio adapter is maintained and distributed by Dremio starting with version 1.1.0b.
2020
2121
## Getting started
2222

2323
- [Install dbt-dremio](https://docs.getdbt.com/reference/warehouse-setups/dremio-setup)
24-
- Version 1.9.0 of dbt-dremio requires dbt-core >= 1.9.*.
24+
- Version 1.10.0 of dbt-dremio requires dbt-core >= 1.10.*.
2525
- Read the [introduction](https://docs.getdbt.com/docs/introduction/) and [viewpoint](https://docs.getdbt.com/docs/about/viewpoint/)
2626

2727
## Join the dbt Community

dbt/adapters/dremio/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@
99
# See the License for the specific language governing permissions and
1010
# limitations under the License.
1111

12-
version = "1.9.0"
12+
version = "1.10.0"

dbt/adapters/dremio/relation.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
BaseRelation,
1919
Policy,
2020
ComponentName,
21+
EventTimeFilter,
2122
)
2223
from typing import Optional, Tuple, Iterator
2324

@@ -45,6 +46,7 @@ class DremioRelation(BaseRelation):
4546
no_schema = "no_schema"
4647
format: Optional[str] = None
4748
format_clause: Optional[str] = None
49+
event_time_filter: Optional[EventTimeFilter] = None
4850

4951
def quoted_by_component(self, identifier, componentName):
5052
dot_char = "."
@@ -85,3 +87,42 @@ def _render_iterator(
8587
): # or key == ComponentName.Schema):
8688
path_part = self.quoted_by_component(path_part, key)
8789
yield key, path_part
90+
91+
def _format_timestamp(self, timestamp_str: str) -> str:
92+
"""
93+
Convert timestamp with timezone info to Dremio-compatible format.
94+
Removes timezone information and limits microseconds precision since Dremio
95+
doesn't support timezone info in timestamp literals and has limited microsecond precision.
96+
97+
Example: '2025-10-02 11:45:01.142708+00:00' -> '2025-10-02 11:45:01.142'
98+
"""
99+
if timestamp_str is None:
100+
return timestamp_str
101+
102+
# Remove timezone information (e.g., +00:00, -05:00, Z)
103+
# This regex matches timezone patterns at the end of the string
104+
timestamp_str = str(timestamp_str)
105+
timestamp_str = re.sub(r'[+-]\d{2}:\d{2}$|Z$', '', timestamp_str)
106+
107+
# Limit microseconds to 3 digits (milliseconds) as Dremio does not support full 6-digit microseconds
108+
# Pattern: YYYY-MM-DD HH:MM:SS.ssssss -> YYYY-MM-DD HH:MM:SS.sss
109+
timestamp_str = re.sub(r'(\.\d{3})\d{3}$', r'\1', timestamp_str)
110+
111+
return timestamp_str
112+
113+
# Override in order to apply _format_timestamp
114+
def _render_event_time_filtered(self, event_time_filter: EventTimeFilter) -> str:
115+
"""
116+
Returns "" if start and end are both None
117+
"""
118+
filter = ""
119+
start_ts = self._format_timestamp(event_time_filter.start)
120+
end_ts = self._format_timestamp(event_time_filter.end)
121+
if event_time_filter.start and event_time_filter.end:
122+
filter = f"{event_time_filter.field_name} >= '{start_ts}' and {event_time_filter.field_name} < '{end_ts}'"
123+
elif event_time_filter.start:
124+
filter = f"{event_time_filter.field_name} >= '{start_ts}'"
125+
elif event_time_filter.end:
126+
filter = f"{event_time_filter.field_name} < '{end_ts}'"
127+
128+
return filter

dbt/include/dremio/macros/builtins/builtins.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ limitations under the License.*/
2424
and model.config.format is defined
2525
else none -%}
2626
{%- set format_clause = format_clause_from_node(model.config) if format is not none else none -%}
27-
{%- set relation2 = api.Relation.create(database=relation.database, schema=relation.schema, identifier=relation.identifier, format=format, format_clause=format_clause, limit=relation.limit) -%}
27+
{%- set relation2 = api.Relation.create(database=relation.database, schema=relation.schema, identifier=relation.identifier, format=format, format_clause=format_clause, limit=relation.limit, event_time_filter=relation.event_time_filter) -%}
2828
{{ return (relation2) }}
2929
{%- else -%}
3030
{{ return (relation) }}
@@ -40,7 +40,7 @@ limitations under the License.*/
4040
and source.external.format is defined
4141
else none -%}
4242
{%- set format_clause = format_clause_from_node(source.external) if format is not none else none -%}
43-
{%- set relation2 = api.Relation.create(database=relation.database, schema=relation.schema, identifier=relation.identifier, format=format, format_clause=format_clause, limit=relation.limit) -%}
43+
{%- set relation2 = api.Relation.create(database=relation.database, schema=relation.schema, identifier=relation.identifier, format=format, format_clause=format_clause, limit=relation.limit, event_time_filter=relation.event_time_filter) -%}
4444
{{ return (relation2) }}
4545
{%- else -%}
4646
{{ return (relation) }}

dev_requirements.txt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ Babel==2.12.1
33
betterproto==1.2.5
44
certifi==2023.7.22
55
charset-normalizer==3.1.0
6-
dbt-core==1.9.0
7-
dbt-tests-adapter==1.11.0
6+
dbt-core==1.10.0
7+
dbt-tests-adapter==1.16.0
88
python-dotenv==1.0.1
99
exceptiongroup==1.1.1
1010
future==0.18.3
@@ -13,11 +13,9 @@ h2==4.1.0
1313
hpack==4.0.0
1414
hyperframe==6.0.1
1515
iniconfig==2.0.0
16-
jsonschema==4.17.3
1716
leather==0.3.4
1817
MarkupSafe==2.1.2
1918
msgpack==1.0.5
20-
multidict==6.0.4
2119
parsedatetime==2.4
2220
pip-licenses==4.1.0
2321
pluggy==1.0.0

setup.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
package_name = "dbt-dremio"
2424

25-
package_version = "1.9.0"
25+
package_version = "1.10.0"
2626

2727
description = """The Dremio adapter plugin for dbt"""
2828

@@ -37,9 +37,9 @@
3737
packages=find_namespace_packages(include=["dbt", "dbt.*"]),
3838
include_package_data=True,
3939
install_requires=[
40-
"dbt-core>=1.9",
41-
"dbt-common>=1.11,<2.0",
42-
"dbt-adapters>=1.10.1, <2.0",
40+
"dbt-core>=1.10",
41+
"dbt-common>=1.27,<2.0",
42+
"dbt-adapters>=1.16.1, <2.0",
4343
"requests>=2.31.0",
4444
],
4545
classifiers=[

tests/functional/adapter/basic/test_concurrency.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,4 +113,4 @@ def test_concurrency(self, project):
113113
check_table_does_not_exist(project.adapter, "invalid")
114114
check_table_does_not_exist(project.adapter, "skip")
115115

116-
assert "PASS=5 WARN=0 ERROR=1 SKIP=1 TOTAL=7" in output
116+
assert "PASS=5 WARN=0 ERROR=1 SKIP=1 NO-OP=0 TOTAL=7" in output

0 commit comments

Comments
 (0)