问题描述
我遇到一个奇怪的问题,我的数据采用 UTC 格式,而数据选择器选择时间偏移量很大。我希望用户界面仅选择 UTC 时间。
在文档中,它指出 Superset 构建为仅在 UTC 时间运行。我还发现一些线程可以通过将 Linux 环境通过 ENV 变量设置为其他时区来改变这一点:
ENV TZ Europe/Amsterdam
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
错误行为(UTC 时间约为 12 月 22 日 17 点):
(所有仪表板中的行为相同)
这个数据背后的查询(我使用了“在 sqlLab 中查看查询”)
SELECT toDateTime(intDiv(toUInt32(toDateTime(delivery_date)),300)*300) AS __timestamp,COUNT(*) AS count
FROM spearad_data.a_performance_view
WHERE delivery_date >= toDateTime('2020-12-21 23:00:00')
AND delivery_date < toDateTime('2020-12-22 00:00:00')
GROUP BY toDateTime(intDiv(toUInt32(toDateTime(delivery_date)),300)*300)
ORDER BY count DESC
LIMIT 10000;
就我而言,我确实检查了 ECS docker 容器和运行任务(容器)的 EC2 实例。
EC2 机器:
[ec_user@1.2.3.4]$date
Tue Dec 22 16:31:07 UTC 2020
[ec2-user@1.2.3.4]$ echo $TZ
[ec2-user@ip-1-2-3-4]$ date +'%:z %Z'
+00:00 UTC
[ec2-user@ip-1-2-3-4]$ cat /etc/timezone
cat: /etc/timezone: No such file or directory
[ec2-user@ip-1-2-3-4]$ cat /etc/timezone
cat: /etc/timezone: No such file or directory
[ec2-user@ip-1-2-3-4]$ timedatectl
Local time: Tue 2020-12-22 16:40:47 UTC
Universal time: Tue 2020-12-22 16:40:47 UTC
RTC time: Tue 2020-12-22 16:40:42
Time zone: n/a (UTC,+0000)
NTP enabled: yes
NTP synchronized: no
RTC in local TZ: no
DST active: n/a
ECS 容器:
/ # date
Tue Dec 22 16:43:53 UTC 2020
/ # echo $TZ
/ # date +'%:z %Z'
/ # cat /etc/timezone
cat: can't open '/etc/timezone': No such file or directory
Clickhouse 数据库:
SELECT Now();
2020-12-22T16:50:32
超集 MysqL (AWS RDS):
SELECT Now();
2020-12-22T16:52:27
16:57:01
created_on
2020-12-22T16:59:03
数据也是基于 UTC 的。那么我需要在哪里改变这个?似乎缺少其他设置或配置。
我有以下设置:
- AWS ECS 上的 Apache Superset 0.37
- 超集 ConfigDB:AWS RDS
- 事实数据库:Clickhouse DB 20.7
- 驱动程序:clickhouse-sqlalchemy(原生模式)
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)