Open ikeniborn opened 1 year ago
@gfunc @zli06160 -- any possibility one of you could take a look at this? Thanks!
I will take a look.
I think it is a problem with the exchange macro. It should not give theon cluster
clause for table materialization.
Hi @ikeniborn, are you expecting the table to be created on cluster or not? If you are trying to use a clickhouse cluster, you should use distributed_table
materialization.
I can reproduce the problem now. It seems to be a compatibility issue.
model dimension.dim_twitter_pinned_tweet
already exists on the cluster. But with the latest dbt-clickhouse
ver 1.4.9 during the creation of the __dbt_backup table, there is no on cluster
clause.
I suggest a full-refresh
with distributed_table
materialization if possible, meanwhile, I will prepare a fix.
In #206 my solution to this problem is that we provide a detailed message to reflect the error and make full-refresh
workable in this situation.
I am not sure this is the best way. so any comments, suggestions are welcomed.
I will take a look. I think it is a problem with the exchange macro. It should not give the
on cluster
clause for table materialization.Hi @ikeniborn, are you expecting the table to be created on cluster or not? If you are trying to use a clickhouse cluster, you should use
distributed_table
materialization.
Hi, @gfunc I reinstall dbt-clickhouse on 1.4.8 where all work without error. I have 1 shard and 2 replicas on cluster. I dont want used now distributed table. I want only create table on cluster. When claster will have more 1 shard i refactoring all models to dictributed_table i wait fix this error. Thank you.
Describe the bug
Steps to reproduce
1. 2. 3.
clickhouse: target: default outputs: default: driver: native type: clickhouse schema: default user: "{{ env_var('DBT_ENV_SECRET_USER') }}" password: "{{ env_var('DBT_ENV_SECRET_PASSWORD') }}"
optional fields
Expected behaviour
{{ config( enabled = true, schema = 'dimension', tags = ["dimension"], materialized = "table", engine = "MergeTree()", order_by = ("twitter_pinned_tweet_id"), ) }}
select pinned_tweet_id as twitter_pinned_tweet_id ,pinned_tweet_text as twitter_pinned_tweet_text -- ,vector(pinned_tweet_text) as twitter_pinned_tweet_text_vector ,pinned_tweet_created_at as twitter_pinned_tweet_created_at ,date_diff('day',pinned_tweet_created_at, now()) as twitter_pinned_tweet_day_old ,now() as updated_dttm from {{ref("raw_twitter_pinned_tweets")}} order by updated_dttm desc limit 1 by pinned_tweet_id
Code examples, such as models or profile settings
dbt and/or ClickHouse server logs
[0m12:50:07.068025 [debug] [Thread-1 ]: dbt_clickhouse adapter: On model.clickhouse.dim_twitter_pinned_tweet: /* {"app": "dbt", "dbt_version": "1.4.9", "profile_name": "clickhouse", "target_name": "****", "node_id": "model.clickhouse.dim_twitter_pinned_tweet"} /
[0m12:50:07.254117 [debug] [Thread-1 ]: dbt_clickhouse adapter: SQL status: OK in 0.19 seconds [0m12:50:07.338073 [debug] [Thread-1 ]: dbt_clickhouse adapter: On model.clickhouse.dim_twitter_pinned_tweet: /* {"app": "dbt", "dbt_version": "1.4.9", "profile_name": "clickhouse", "target_name": "****", "node_id": "model.clickhouse.dim_twitter_pinned_tweet"} /
engine = MergeTree() order by (twitter_pinned_tweet_id)
select pinned_tweet_id as twitter_pinned_tweet_id ,pinned_tweet_text as twitter_pinned_tweet_text -- ,vector(pinned_tweet_text) as twitter_pinned_tweet_text_vector ,pinned_tweet_created_at as twitter_pinned_tweet_created_at ,date_diff('day',pinned_tweet_created_at, now()) as twitter_pinned_tweet_day_old ,now() as updated_dttm from raw.raw_twitter_pinned_tweets order by updated_dttm desc limit 1 by pinned_tweet_id ) ... [0m12:50:07.429639 [debug] [Thread-1 ]: dbt_clickhouse adapter: SQL status: OK in 0.09 seconds [0m12:50:07.460572 [debug] [Thread-1 ]: dbt_clickhouse adapter: On model.clickhouse.dim_twitter_pinned_tweet: /* {"app": "dbt", "dbt_version": "1.4.9", "profile_name": "clickhouse", "target_name": "****", "node_id": "model.clickhouse.dim_twitter_pinned_tweet"} /
... [0m12:50:07.529162 [debug] [Thread-1 ]: dbt_clickhouse adapter: SQL status: OK in 0.07 seconds [0m12:50:07.549063 [debug] [Thread-1 ]: Writing runtime sql for node "model.clickhouse.dim_twitter_pinned_tweet" [0m12:50:07.550210 [debug] [Thread-1 ]: dbt_clickhouse adapter: On model.clickhouse.dim_twitter_pinned_tweet: /* {"app": "dbt", "dbt_version": "1.4.9", "profile_name": "clickhouse", "target_name": "****", "node_id": "model.clickhouse.dim_twitter_pinned_tweet"} /
select pinned_tweet_id as twitter_pinned_tweet_id ,pinned_tweet_text as twitter_pinned_tweet_text -- ,vector(pinned_tweet_text) as twitter_pinned_tweet_text_vector ,pinned_tweet_created_at as twitter_pinned_tweet_created_at ,date_diff('day',pinned_tweet_created_at, now()) as twitter_pinned_tweet_day_old ,now() as updated_dttm from raw.raw_twitter_pinned_tweets order by updated_dttm desc limit 1 by pinned_tweet_id ... [0m12:50:07.686856 [debug] [Thread-1 ]: dbt_clickhouse adapter: SQL status: OK in 0.14 seconds [0m12:50:07.706430 [debug] [Thread-1 ]: dbt_clickhouse adapter: On model.clickhouse.dim_twitter_pinned_tweet: /* {"app": "dbt", "dbt_version": "1.4.9", "profile_name": "clickhouse", "target_name": "****", "node_id": "model.clickhouse.dim_twitter_pinned_tweet"} / EXCHANGE TABLES dimension.dim_twitter_pinned_tweet__dbt_backup AND dimension.dim_twitter_pinned_tweet
... [0m12:50:07.902549 [debug] [Thread-1 ]: dbt_clickhouse adapter: Error running SQL: /* {"app": "dbt", "dbt_version": "1.4.9", "profile_name": "clickhouse", "target_name": "****", "node_id": "model.clickhouse.dim_twitter_pinned_tweet"} / EXCHANGE TABLES dimension.dim_twitter_pinned_tweet__dbt_backup AND dimension.dim_twitter_pinned_tweet
[0m12:50:07.903325 [debug] [Thread-1 ]: Timing info for model.clickhouse.dim_twitter_pinned_tweet (execute): 2023-11-08 12:50:06.967194 => 2023-11-08 12:50:07.903201 [0m12:50:07.907147 [debug] [Thread-1 ]: Database Error in model dim_twitter_pinned_tweet (models/dimension/twitter/dim_twitter_pinned_tweet.sql) Code: 60. DB::Exception: There was an error on [10.10.1.217:9000]: Code: 60. DB::Exception: Table
dimension
.dim_twitter_pinned_tweet__dbt_backup
doesn't exist. (UNKNOWN_TABLE) (version 23.10.1.1976 (official build)). Stack trace:Configuration
Environment
ClickHouse server
CREATE TABLE
statements for tables involved: