问题描述
我找到了关于这个主题的网址:
- https://cube.dev/docs/types-and-formats#dimensions-formats
- https://cube.dev/docs/working-with-string-time-dimensions
我没有找到时间类型的格式。
所以我尝试使用 sql:PARSE_TIMESTAMP('%Y-%m-%d',date)
createdat: {
sql: `PARSE_TIMESTAMP('%Y-%m-%d',${CUBE}.\`createdAt\`)`,type: `time`
},
Error: Error: scalar function 'parse_timestamp' is not supported
解决方法
createdat: {
sql: `DATE(${CUBE}.\`createdAt\`,'%Y-%m-%d')`,type: `time`
},
谢谢