AWS 中的自动时间转换为 Snowflake

Automatic Time Conversion in AWS to Snowflake

我在 Google 的 App Engine 中使用 Python 将字段从 AWS 缓存到 Snowflake。问题是当我没有在 Python 代码中做任何更改时间的事情时,Snowflake 中的所有时间都增加了 7 个小时。

在 Snowflake 中是否有特定的设置来处理这个问题,即将它设置为采用文字时间戳而不是一个调整?

AWS

ID|Minute of INSERTED AT
1|Jun 30, 2020 01:49

顺丰

ID|Minute of INSERTED AT
1|Jun 30, 2020 08:49

没有文档这样说,但我从未遇到过遇到此类问题的人。

Google 的数据存储 (GAE) 中的日期时间采用 UTC [1]。我认为同样的原则也适用于 Snowflake。基于此,您应该让您的代码针对 UTC 时间进行必要的调整。

  1. https://cloud.google.com/appengine/docs/standard/python/ndb/entity-property-reference#Date_and_Time

Snowflake 有一个时区帐户参数。从帐户向下级联到用户,从用户到会话。

select current_timestamp(); -- This will show you the time zone offset for the session.
alter session set TIMEZONE = 'Etc/UTC'; --This will set to UTC
select current_timestamp(); -- Confirm it's set to offset +0000