ClickHouse / metabase-clickhouse-driver

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

Map ClickHouse DateTime('Europe/Berlin') to Metabase type/DateTime #178

Closed gegl closed 11 months ago

gegl commented 11 months ago

Describe the bug

When a ClickHouse DateTime is associated with a TimeZone after converting from UTC to TimeZone in a ClickHouse view, the resulting type DateTime('Europe/Berlin') is not mapped to Metabase type/DateTime. It falls back on type/*. This negatively affects UIs for filtering in Metabase.

Steps to reproduce

Use any column where a TimeZone version is applied eg. toTimeZone(, 'Europe/Berlin') :

SELECT toTimeZone(now(), 'Europe/Berlin') as date_time_with_timezone_conversion

The resulting ClickHouse data type is DateTime('Europe/Berlin') according to DESC <table name>

When passed throuh the metabase-clickhouse-driver it is mapped to type/*

Expected behaviour

DateTime('Europe/Berlin') is mapped to type/DateTime

Configuration

Environment

ClickHouse server

CREATE VIEW membership_activations_view
(
    `activation_datetime` DateTime('Europe/Berlin'),
    `signup_datetime` DateTime('Europe/Berlin'),
    ....
) AS
SELECT
    toTimeZone(activation_datetime, 'Europe/Berlin') AS activation_datetime,
    toTimeZone(signup_datetime, 'Europe/Berlin') AS signup_datetime,
    ....
FROM membership_activations
slvrtrn commented 11 months ago

Fixed in 1.2.0

brendavarguez commented 9 months ago

Hello! @slvrtrn I had a similar issue that you can find here. I understand that it should have been solved with Metabase version 0.47, but I'm already using 0.47.1 version and the issue persist. Should it be re-opened?

slvrtrn commented 9 months ago

@brendavarguez, if this issue still persists on 1.2.1, feel free to re-open this issue with more details.