Skip to content

Commit 390ceb7

Browse files
Merge pull request #808 from elementary-data/ele-4308-fix-artifacts-update-on-clickhouse
fixed artifacts update on clickhouse changed old dbt version from 1.7.0 to 1.8.0
2 parents 1517d9d + 7e171b8 commit 390ceb7

File tree

5 files changed

+31
-4
lines changed

5 files changed

+31
-4
lines changed

.github/workflows/test-all-warehouses.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ jobs:
5151
clickhouse,
5252
]
5353
include:
54-
# If we're not running on a specific dbt version, then always add postgres on 1.7.0
55-
- dbt-version: "${{ inputs.dbt-version || '1.7.0' }}"
54+
# If we're not running on a specific dbt version, then always add postgres on 1.8.0
55+
- dbt-version: "${{ inputs.dbt-version || '1.8.0' }}"
5656
warehouse-type: postgres
5757
- dbt-version: "${{ inputs.dbt-version || 'latest_pre' }}"
5858
warehouse-type: postgres

integration_tests/deprecated_tests/macros/e2e_tests/clear_tests.sql

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,24 @@
1616
{% endmacro %}
1717

1818
{% macro drop_schema(database_name, schema_name) %}
19+
{% do adapter.dispatch('drop_schema')(database_name, schema_name) %}
20+
{% endmacro %}
21+
22+
{% macro default__drop_schema(database_name, schema_name) %}
1923
{% set schema_relation = api.Relation.create(database=database_name, schema=schema_name) %}
2024
{% do dbt.drop_schema(schema_relation) %}
2125
{% do adapter.commit() %}
2226
{% do elementary.edr_log("dropped schema {}".format(schema_relation | string)) %}
2327
{% endmacro %}
28+
29+
{% macro clickhouse__drop_schema(database_name, schema_name) %}
30+
{% set results = run_query("SELECT name FROM system.tables WHERE database = '" ~ database_name ~ "'") %}
31+
{% if execute %}
32+
{% for row in results %}
33+
{% set table = row[0] %}
34+
{% do run_query("DROP TABLE IF EXISTS " ~ database_name ~ "." ~ table) %}
35+
{% endfor %}
36+
{% endif %}
37+
{% do adapter.commit() %}
38+
{% do elementary.edr_log("dropped schema {}".format(schema_name)) %}
39+
{% endmacro %}

integration_tests/tests/test_dbt_artifacts/test_artifacts.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ def test_artifacts_caching(dbt_project: DbtProject):
2323
assert first_row == second_row, "Artifacts are not cached at the on-run-end."
2424

2525

26-
# Artifacts updating currently not supported on ClickHouse
27-
@pytest.mark.skip_targets(["clickhouse"])
2826
def test_artifacts_updating(dbt_project: DbtProject):
2927
# Disabled by default in the tests for performance reasons.
3028
dbt_project.dbt_runner.vars["disable_dbt_artifacts_autoupload"] = False

macros/utils/table_operations/has_temp_table_support.sql

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,7 @@
1818
{% do return(false) %}
1919
{% endmacro %}
2020

21+
{% macro clickhouse__has_temp_table_support() %}
22+
{% do return(false) %}
23+
{% endmacro %}
24+

macros/utils/table_operations/make_temp_relation.sql

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,12 @@
5353
{% do return(tmp_relation) %}
5454
{% endmacro %}
5555

56+
{% macro clickhouse__make_temp_table_relation(base_relation, suffix) %}
57+
{% set tmp_identifier = elementary.table_name_with_suffix(base_relation.identifier, suffix) %}
58+
{% set tmp_relation = api.Relation.create(
59+
identifier=tmp_identifier,
60+
schema=base_relation.schema,
61+
database=base_relation.database,
62+
type='table') %}
63+
{% do return(tmp_relation) %}
64+
{% endmacro %}

0 commit comments

Comments
 (0)