Open larsrinn opened 3 months ago
I think that's hardcoded here:
Perhaps we could add a new target setting to switch to mapping from JSON date-time
strings to TIMESTAMP_TZ
.
PRs welcome!
How would that work? Wouldn't it be required for the tap's schema to claim a given column has datetime-values with timezone information? I didn't find such an option in the Singer-SDK.
How would that work? Wouldn't it be required for the tap's schema to claim a given column has datetime-values with timezone information? I didn't find such an option in the Singer-SDK.
In short, what I mean is we could add a user-level setting, e.g. use_timestamp_tz
to decide if the target uses TIMESTAMP_NTZ
(the default) or TIMESTAMP_TZ
.
The JSON Schema spec, which the target uses to determine column types, expects rfc3339 date-times^1 but by default there's enforcement of that specific format, so expecting a full rfc3339 string by default might break some users' pipelines.
So what you're saying is:
date-time
as timestamps with timezone informationtarget-snowflake
maps this to timestamp_ntz
columns and hence, throwing away the timezone informationdate-time
should be mapped to timestamp_tz
or timestamp_ntz
, defaulting to timestamp_ntz
?All correct. In short, I worry that timestamp_tz
might cast datetime strings differently and might not accept something like 2020-01-01T00:00:00
(i.e. without a tz component), which users might be currently sending to the target.
I worry that
timestamp_tz
might cast datetime strings differently and might not accept something like2020-01-01T00:00:00
Is that something you could confirm? Essentially I want to validate how snowflake handles a few cases:
-- date
'2020-01-01'::TIMESTAMP_NTZ
'2020-01-01'::TIMESTAMP_TZ
-- date-time without tz
'2020-01-01T00:00:00'::TIMESTAMP_NTZ
'2020-01-01T00:00:00'::TIMESTAMP_TZ
-- date-time with offset
'2020-01-01T00:00:00+00:00'::TIMESTAMP_NTZ
'2020-01-01T00:00:00+00:00'::TIMESTAMP_TZ
-- date-time with Z
'2020-01-01T00:00:00+00:00Z'::TIMESTAMP_NTZ
'2020-01-01T00:00:00+00:00Z'::TIMESTAMP_TZ
I have a tap which generates data with
DateTimeType
. Unfortunately, when loaded into Snowflake, the timezone information vanishes and data is stored astimestamp_ntz
. Am I doing something wrong? I would like to have it astimestamp_tz