问题描述
我正在学习 https://real-time-dashboard.cube.dev/cube-js-api-with-mongo-db
中的教程,并从那里获取如下所示的数据集。
我的架构如下所示。
cube(`Events`,{
sql: `SELECT
*
FROM stats.events`,refreshKey: {
sql: `SELECT UNIX_TIMESTAMP()`,},measures: {
count: {
type: `count`,online: {
type: `countdistinct`,sql: `${anonymousId}`,filters: [{ sql: `${timestamp} > date_sub(Now(),interval 3 minute)` }],pageView: {
type: `count`,filters: [{ sql: `${eventType} = 'pageView'` }],buttonClick: {
type: `count`,filters: [{ sql: `${eventType} = 'buttonClicked'` }],urlIsNotEmpty: {
type: `count`,filters: [{ sql: `${url} = https://cubejs-real-time-demo.herokuapp.com/#/` }],urlIsEmpty: {
type: `count`,filters: [{ sql: `${url} = ''` }],dimensions: {
secondsAgo: {
sql: `TIMESTAMPDIFF(SECOND,timestamp,Now())`,type: `number`,anonymousId: {
sql: `${CUBE}.\`anonymousId\``,type: `string`,eventType: {
sql: `${CUBE}.\`eventType\``,url: {
sql: `\`url\``,timestamp: {
sql: `${CUBE}.\`timestamp\``,type: `time`,referrer: {
sql: `\`events.referrer\``,id: {
sql: `${CUBE}._id`,});
id、enveyType、anontymouseId、secondsAgo 工作正常。但是,当我尝试访问 url
和 referrer
时,我收到了这样的错误 UnkNown column 'events.url' in 'field list'
,Error: Error: UnkNown column 'events.referrer' in 'field list'
。有人帮忙吗?
解决方法
您能否尝试将您的 referrer
定义更改为:
referrer: {
sql: `${CUBE}.referrer`,type: `string`,},
同样适用于 url
维度。