ClickHouse / metabase-clickhouse-driver

ClickHouse database driver for the Metabase business intelligence front-end
Apache License 2.0
476 stars 92 forks source link

problem with field classification in metabase when field are defined as nullable in clickhouse #203

Closed alongls closed 11 months ago

alongls commented 11 months ago

in the clickhouse DB the column is defined as - LowCardinality(Nullable(String)) in this case when the metabase syncs with the database the field is define as type/* and not as type/Text

when the column in the clickhouse is defined as LowCardinality(String) the field in metabase is described as type/Text

the problem - in a dashboards when trying to define a search again a filed that metabase classified as type/* we get an error (Cannot search against non-Text Field) and the search fails:

error is: 2023-11-05 15:13:09,094 DEBUG middleware.log :: GET /api/dashboard/115/params/7e7fa74e/search/visa 400 64.0 ms (10 DB calls) {:via [{:type clojure.lang.ExceptionInfo, :message "Cannot search against non-Text Field 144 "OG_CustomerName"", :data {:status-code 400, :field-id 144, :field "OG_CustomerName", :base-type :type/*}, :at [metabase.models.params.chain_filter$check_valid_search_field invokeStatic "chain_filter.clj" 601]}], :trace [[metabase.models.params.chain_filter$check_valid_search_field invokeStatic "chain_filter.clj" 601] [metabase.models.params.chain_filter$check_valid_search_field invoke "chain_filter.clj" 592] [metabase.models.params.chain_filter$fn__104174$unremapped_chain_filter_search104179$fn104180 invoke "chain_filter.clj" 612]

To Reproduce in clickhouse define a column as LowCardinality(Nullable(String)) - try to run a search against it in a dashboard define a search filter against this field . no value will be retrieved (in a question it will retrieve the data) change the filed to LowCardinality(String) try to run the search against it and it will sucseed Expected behavior the metabase should read "LowCardinality(String)" as test fields

alongls commented 11 months ago

ClickHouse Table Definition

alongls commented 11 months ago

Metabase_Metadata full error message.TXT

slvrtrn commented 10 months ago

@alongls, it should be fixed by 1.2.3