ClickHouse / dbt-clickhouse

The Clickhouse plugin for dbt (data build tool)
Apache License 2.0
242 stars 98 forks source link

Table and Column Comments set up misbehaviour #295

Open GavrG opened 3 months ago

GavrG commented 3 months ago

Describe the bug

Testing v1.7.7 Community PRs exacly: allows to add a comment in table's or view's metadata by @dstsimokha in https://github.com/ClickHouse/dbt-clickhouse/pull/228 We've found, that generated ALTER TABLE SQL "ignores" ON CLUSTER clause and all changes done only on connection node. Clickhouse and DBT does not return any errors.

Steps to reproduce

  1. Create a model: models\test_comment_model.sql
    
    {{
    config
      (
        materialized = 'table',
        schema = 'dbt__core',
        order_by=('some_id'),
        engine='ReplicatedMergeTree',
        persist_docs={"relation": true, "columns": true}
      )
    }}

Select 1 AS some_id, '----' AS some_column_name, '++++' AS some_other_column_name

2. Create a description: models\models.yml

version: 2 models:

5.2. tables comments

SELECT hostName() as hostName,`database`, name, `comment`, *
FROM clusterAllReplicas('{cluster}', system.tables)
where database = 'dbt__core'
and name = 'test_comment_model'
order by database,  name, hostName

hostName |database |name |comment
-----------------+---------+------------------+-------------------------------+ clickhouse-01|dbtcore|test_comment_model |test_comment_model description clickhouse-02|dbtcore|test_comment_model |

Expected behaviour

Comments should be on all nodes

Fix proposal

Split single command to two

dbt and/or ClickHouse server logs

Configuration

Environment

ClickHouse server

simpl1g commented 3 months ago

The query looks correct, I believe it should be a bug created in ClickHouse itself, not in dbt adapter

GavrG commented 3 months ago

The query looks correct, I believe it should be a bug created in ClickHouse itself, not in dbt adapter

Agree, but two points:

emirkmo commented 1 month ago

Have you found or reported the bug to ClickHouse? It is the very active, good chance it is fixed. If not, please let me know as I want to report it.

genzgd commented 1 month ago

https://github.com/ClickHouse/ClickHouse/issues/55720, although I would have though the fix would be in 24.2. Is this is ClickHouse Cloud instance?

emirkmo commented 1 month ago

Interesting. We are running an ever so slightly older version than when the bug appears. We see still see the issue that only the communicator node gets the comments and it is missing from all others. So no proper DDL. Hmm