ClickHouse / metabase-clickhouse-driver

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

feature: Add DateTime with timezone support #154

Closed mlosnikov closed 11 months ago

mlosnikov commented 1 year ago

Summary

Metabase builder generates condition like this on DateTime column even if local timezone is enabled: column_name >= parseDateTimeBestEffort('2023-03-13 00:00:00.000Z')

For comparison, with Postgres it looks like this: "column_name" >= timestamp with time zone '2023-03-13 00:00:00.000-04:00'

This PR just extends regex for column mapping to properly handle columns with type DateTime('Timezone')

Some tests with this regex: https://regex101.com/r/Yahlbt/1

Checklist

Delete items not relevant to your PR:

CLAassistant commented 1 year ago

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

slvrtrn commented 1 year ago

@mlosnikov, shall we also support DateTime64 in this scenario?

mlosnikov commented 1 year ago

@slvrtrn I suppose so. I included \d* pattern for both Enum and DateTime. Also, there are tests for such cases here: https://regex101.com/r/Yahlbt/1

slvrtrn commented 1 year ago

This is great. Thanks for your contribution! Do you think it is possible to add some tests as well?

slvrtrn commented 11 months ago

Closing this in favor of #181