Skip to content

Commit

Permalink
Snowflake to use TIMESTAMP with TIME ZONE instead of TIMESTAMP_NTZ (#111
Browse files Browse the repository at this point in the history
)
  • Loading branch information
Tang8330 authored May 31, 2023
1 parent d68a4d7 commit a23376c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/typing/snowflake.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package typing

import (
"github.com/artie-labs/transfer/lib/typing/ext"
"strings"

"github.com/artie-labs/transfer/lib/typing/ext"
)

type SnowflakeKind string
Expand Down Expand Up @@ -82,7 +83,11 @@ func kindToSnowflake(kindDetails KindDetails) string {
case ETime.Kind:
switch kindDetails.ExtendedTimeDetails.Type {
case ext.DateTimeKindType:
return "datetime"
// We are not using `TIMESTAMP_NTZ` because Snowflake does not join on this data very well.
// It ends up trying to parse this data into a TIMESTAMP_TZ and messes with the join order.
// Specifically, if my location is in SF, it'll try to parse TIMESTAMP_NTZ into PST then into UTC.
// When it was already stored as UTC.
return "timestamp_tz"
case ext.DateKindType:
return "date"
case ext.TimeKindType:
Expand Down

0 comments on commit a23376c

Please sign in to comment.