amazon athena 时间戳的 strftime 配置是什么

What is the strftime config for an amazon athena timestamp

在 python 3 中,我会这样做:

"{0:Y-M-d H:m:?.???}".format(datetime.datetime.now())

不过,经过一番搜索,如果能在某个地方找到规范的答案就好了。

最终,我选择不使用时间戳,而是将其视为整数并存储自纪元以来的秒数。这会以更少的戏剧效果产生相同的结果。 Athena 具有将这些整数转换为日期数学所需的所有函数。所以它更容易。

比赛晚了,我喜欢你只使用总秒数的回答,但这是我让 athena(使用 awswrangler)与 datetime 和 strftime 一起工作的方式

query_date = datetime.now().strftime('%Y-%m-%d %H:%M:%S')

query_statement = f"SELECT * FROM table where datetime_col > timestamp '{query_date}'"

我的 datetime_col 有 3 毫秒,但在我的查询中没有必要