ClickHouse / ClickHouse/dbt-clickhouse
Contract validation failed if data_type in lower case
- Dominant language
- Python
- Stars
- 362
- Forks
- 177
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 8
Description
Common practice in dbt that column types for contract generated in lower case (dbt vs code extension, dbt-meshify and so on..)
Expected that contract should be passed ignore case
```
This model has an enforced contract that failed.
Please ensure the name, data_type, and number of columns in your contract match the columns in your model's definition.
| column_name | definition_type | contract_type | mismatch_reason |
| ------------------------- | ------------------ | ------------------ | ------------------ |
| work_amount | Nullable(Float64) | nullable(float64) | data type mismatch |
| work_position | Nullable(String) | nullable(string) | data type mismatch |
> in macro clickhouse__get_assert_columns_equivalent (macros/column_spec_ddl.sql)
> called by macro get_assert_columns_equivalent (macros/relations/column/columns_spec_ddl.sql)
> called by macro create_table_or_empty (macros/materializations/table.sql)
> called by macro clickhouse__create_table_as (macros/materializations/table.sql)
> called by macro create_table_as (macros/relations/table/create.sql)
> called by macro default__get_create_table_as_sql (macros/relations/table/create.sql)
> called by macro get_create_table_as_sql (macros/relations/table/create.sql)
> called by macro statement (macros/etc/statement.sql)
> called by macro clickhouse__incremental_delete_insert (macros/materializations/incremental/incremental.sql)
> called by macro materialization_incremental_clickhouse (macros/materializations/incremental/incremental.sql)
> called by model int_inflow_all (models/intermediate/inflow/int_inflow_all.sql)
```
Contributor guide
Research direction
Start in macros/column_spec_ddl.sql at clickhouse__get_assert_columns_equivalent and trace the callers shown in the error through macros/relations/column/columns_spec_ddl.sql. Reproduce the contract validation with lower-case data_type values such as nullable(float64) and nullable(string). Done means equivalent data types differing only in case no longer produce a contract mismatch.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- clickhouse, sql
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 67/100