Skip to content

Commit b31acd2

Browse files
authored
Move dbt-adapters as package dependency and lock its version. (#530)
* Move dbt-adapters as package dependency and fix it version. fix unit-test problem after dbt-adapter was updated.
1 parent 2052bf4 commit b31acd2

File tree

4 files changed

+12
-5
lines changed

4 files changed

+12
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#### Bugs
44
* Fix Materialized View not dropped when a model's materialization is changed from materialized_view to view ([#516](https://github.com/ClickHouse/dbt-clickhouse/pull/516)).
55
* Ensure that temporary tables are not accessed with database clause ([#515](https://github.com/ClickHouse/dbt-clickhouse/pull/515)).
6-
6+
* Lock `dbt-adapters` version to avoid incompatibilities caused by unexpected version upgrades ([#530](https://github.com/ClickHouse/dbt-clickhouse/pull/530)).
77

88
### Release [1.9.3], 2025-09-08
99

dbt/include/clickhouse/macros/materializations/unit.sql

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,29 @@
44

55
{% set expected_rows = config.get('expected_rows') %}
66
{% set expected_sql = config.get('expected_sql') %}
7-
{% set tested_expected_column_names = expected_rows[0].keys() if (expected_rows | length ) > 0 else get_columns_in_query(sql) %} %}
7+
{% set tested_expected_column_names = expected_rows[0].keys() if (expected_rows | length ) > 0 else get_columns_in_query(sql) %}
88

99
{%- set target_relation = this.incorporate(type='table') -%}
1010
{%- set temp_relation = make_temp_relation(target_relation, '__dbt_tmp')-%}
1111
{%- set temp_relation = temp_relation.incorporate(is_temporary=True)-%} {# file overwrite to ensure this is marked as temporary #}
1212
{% do run_query(get_create_table_as_sql(True, temp_relation, get_empty_subquery_sql(sql))) %}
1313
{%- set columns_in_relation = adapter.get_columns_in_relation(temp_relation) -%}
1414
{%- set column_name_to_data_types = {} -%}
15+
{%- set column_name_to_quoted = {} -%}
1516
{%- for column in columns_in_relation -%}
1617
{%- do column_name_to_data_types.update({column.name|lower: column.data_type}) -%}
18+
{%- do column_name_to_quoted.update({column.name|lower: column.quoted}) -%}
19+
{%- endfor -%}
20+
21+
{%- set expected_column_names_quoted = [] -%}
22+
{%- for column_name in tested_expected_column_names -%}
23+
{%- do expected_column_names_quoted.append(column_name_to_quoted[column_name|lower]) -%}
1724
{%- endfor -%}
1825

1926
{% if not expected_sql %}
20-
{% set expected_sql = get_expected_sql(expected_rows, column_name_to_data_types) %}
27+
{% set expected_sql = get_expected_sql(expected_rows, column_name_to_data_types, column_name_to_quoted) %}
2128
{% endif %}
22-
{% set unit_test_sql = get_unit_test_sql(sql, expected_sql, tested_expected_column_names) %}
29+
{% set unit_test_sql = get_unit_test_sql(sql, expected_sql, expected_column_names_quoted) %}
2330

2431
{% call statement('main', fetch_result=True) -%}
2532

dev_requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
dbt-core>=1.9.0,<1.10
2-
dbt-adapters>=1.10,<2.0
32
dbt-tests-adapter>=1.10,<2.0
43
clickhouse-connect>=0.7.6
54
clickhouse-driver>=0.2.7

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ def _dbt_clickhouse_version():
5454
},
5555
install_requires=[
5656
f'dbt-core>={dbt_minor_version}',
57+
'dbt-adapters==1.17.0', # This version should be dbt-adapters>=1.17,<2.0, but keeping it fixed for now to avoid unexpected issues. We need to frequently update it.
5758
'clickhouse-connect>=0.6.22',
5859
'clickhouse-driver>=0.2.6',
5960
'setuptools>=0.69',

0 commit comments

Comments
 (0)