Skip to content

Commit e0d59d3

Browse files
author
Michael Myaskovsky
committed
fixed artifacts update
1 parent 1517d9d commit e0d59d3

File tree

4 files changed

+29
-2
lines changed

4 files changed

+29
-2
lines changed

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)