gouline / dbt-metabase

dbt + Metabase integration
https://pypi.org/project/dbt-metabase/
MIT License
442 stars 63 forks source link

Clearing an automatic metabase.semantic_type #131

Closed willbryant closed 1 year ago

willbryant commented 1 year ago

In 646a914009bdfcfbc7c4c36a377a79d7435c73da, you fixed it so that if we haven't specified a metabase.semantic_type.

This is good, but now, how do we explicitly clear a semantic type set by the automagic rules that Metabase applies on schema sync?

Setting metabase.semantic_type: null seems to have no effect. Can we look for the presence of this key, or maybe use a special value?

gouline commented 1 year ago

What value does the API return if you manually clear it in the UI? Is it just null?

willbryant commented 1 year ago

Python None, which is null right?

gouline commented 1 year ago

That's tricky then, the expected behaviour is unless you specify one (or specify null - same result), it doesn't touch what Metabase currently has. So to implement what you want, you would need to invent an explicit null value. I'll think about it.

willbryant commented 1 year ago

FWIW YAML knows the difference between null and "not present in map", so IMHO the explicit null value could be purely internal.

gouline commented 1 year ago

Agreed. Looking at that code now, I might take this opportunity to refactor around it a bit, so I'll fix it.