Skip to content

Commit c2427bc

Browse files
authored
Merge pull request #5 from pratham-ez/feat/bento_kafka_to_clickhouse
Feat/bento kafka to clickhouse
2 parents d9557be + 64b7af1 commit c2427bc

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

internal/custom-kafka-to-flexprice-clickhouse.yaml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,16 @@ pipeline:
5353
root.environment_id = env("FLEXPRICE_ENVIRONMENT_ID").string().or("")
5454
root.external_customer_id = this.orgId.string().or("")
5555
root.source = this.targetItemId.string().or("")
56-
root.timestamp = this.createdAt.string().or("")
56+
57+
# Timestamp: parse ISO 8601 with timezone, then format for ClickHouse
58+
# 1. Check if createdAt exists and is valid
59+
# 2. Parse it as timestamp to preserve timezone info
60+
# 3. Format to ClickHouse DateTime64 format: "2006-01-02 15:04:05.999999"
61+
root.timestamp = if this.createdAt != null && this.createdAt.string().or("") != "" && this.createdAt.string() != "null" {
62+
this.createdAt.ts_parse("2006-01-02T15:04:05.999Z07:00").ts_format("2006-01-02 15:04:05.999999")
63+
} else {
64+
timestamp_unix().ts_format("2006-01-02 15:04:05.999999")
65+
}
5766
5867
# ---- Build event_name SAFELY ----
5968
root.event_name = ""

0 commit comments

Comments
 (0)