Cube.js: 找不到要加入的加入路径

Cube.js: Can't find join path to join

我正在接管一个网站。我再也联系不到以前的开发人员了。他决定使用 cube.js 并且有一次向我展示了一个带有图表的工作 KPI 页面。现在,我正在尝试让页面在我这边工作,并了解他所做的事情。

我已经在我的机器上安装了 cube.js。我们数据库中的集合是 commentsfolderslogspostssessionssubscribersusers。我使用 cubejs generate -t userscubejs generate -t logs 生成 Users.jsLogs.js。例如,这里是生成的 Users.js:

cube(`Users`, {
  sql: `SELECT * FROM news.users`,

  joins: {

  },

  measures: {
    count: {
      type: `count`,
      drillMembers: [currentname, currentprovider, googleJsonDisplayname, googleJsonId, googleJsonNameFamilyname, googleJsonNameGivenname, googleDisplayname, googleId, googleNameFamilyname, googleNameGivenname, googleProvider, localId, localProvider, firstdate]
    },

    googleJsonCircledbycount: {
      sql: `${CUBE}.\`google._json.circledByCount\``,
      type: `sum`,
      title: `Google. Json.circledbycount`
    }
  },

  dimensions: {
    currentname: {
      sql: `${CUBE}.\`currentName\``,
      type: `string`
    },

    currentprovider: {
      sql: `${CUBE}.\`currentProvider\``,
      type: `string`
    },

    firstapp: {
      sql: `${CUBE}.\`firstApp\``,
      type: `string`
    },

    googleJsonDisplayname: {
      sql: `${CUBE}.\`google._json.displayName\``,
      type: `string`,
      title: `Google. Json.displayname`
    },

    googleJsonEtag: {
      sql: `${CUBE}.\`google._json.etag\``,
      type: `string`,
      title: `Google. Json.etag`
    },

    googleJsonGender: {
      sql: `${CUBE}.\`google._json.gender\``,
      type: `string`,
      title: `Google. Json.gender`
    },

    googleJsonId: {
      sql: `${CUBE}.\`google._json.id\``,
      type: `string`,
      title: `Google. Json.id`
    },

    googleJsonImageUrl: {
      sql: `${CUBE}.\`google._json.image.url\``,
      type: `string`,
      title: `Google. Json.image.url`
    },

    googleJsonKind: {
      sql: `${CUBE}.\`google._json.kind\``,
      type: `string`,
      title: `Google. Json.kind`
    },

    googleJsonLanguage: {
      sql: `${CUBE}.\`google._json.language\``,
      type: `string`,
      title: `Google. Json.language`
    },

    googleJsonNameFamilyname: {
      sql: `${CUBE}.\`google._json.name.familyName\``,
      type: `string`,
      title: `Google. Json.name.familyname`
    },

    googleJsonNameGivenname: {
      sql: `${CUBE}.\`google._json.name.givenName\``,
      type: `string`,
      title: `Google. Json.name.givenname`
    },

    googleJsonObjecttype: {
      sql: `${CUBE}.\`google._json.objectType\``,
      type: `string`,
      title: `Google. Json.objecttype`
    },

    googleJsonUrl: {
      sql: `${CUBE}.\`google._json.url\``,
      type: `string`,
      title: `Google. Json.url`
    },

    googleRaw: {
      sql: `${CUBE}.\`google._raw\``,
      type: `string`,
      title: `Google. Raw`
    },

    googleDisplayname: {
      sql: `${CUBE}.\`google.displayName\``,
      type: `string`,
      title: `Google.displayname`
    },

    googleGender: {
      sql: `${CUBE}.\`google.gender\``,
      type: `string`,
      title: `Google.gender`
    },

    googleId: {
      sql: `${CUBE}.\`google.id\``,
      type: `string`,
      title: `Google.id`
    },

    googleNameFamilyname: {
      sql: `${CUBE}.\`google.name.familyName\``,
      type: `string`,
      title: `Google.name.familyname`
    },

    googleNameGivenname: {
      sql: `${CUBE}.\`google.name.givenName\``,
      type: `string`,
      title: `Google.name.givenname`
    },

    googleProvider: {
      sql: `${CUBE}.\`google.provider\``,
      type: `string`,
      title: `Google.provider`
    },

    localExpired: {
      sql: `${CUBE}.\`local.expired\``,
      type: `string`,
      title: `Local.expired`
    },

    localFirstapp: {
      sql: `${CUBE}.\`local.firstApp\``,
      type: `string`,
      title: `Local.firstapp`
    },

    localHash: {
      sql: `${CUBE}.\`local.hash\``,
      type: `string`,
      title: `Local.hash`
    },

    localId: {
      sql: `${CUBE}.\`local.id\``,
      type: `string`,
      title: `Local.id`
    },

    localProvider: {
      sql: `${CUBE}.\`local.provider\``,
      type: `string`,
      title: `Local.provider`
    },

    localSalt: {
      sql: `${CUBE}.\`local.salt\``,
      type: `string`,
      title: `Local.salt`
    },

    localType: {
      sql: `${CUBE}.\`local.type\``,
      type: `string`,
      title: `Local.type`
    },

    localVerificationcode: {
      sql: `${CUBE}.\`local.verificationCode\``,
      type: `string`,
      title: `Local.verificationcode`
    },

    localVerified: {
      sql: `${CUBE}.\`local.verified\``,
      type: `string`,
      title: `Local.verified`
    },

    firstdate: {
      sql: `${CUBE}.\`firstDate\``,
      type: `time`
    }
  }
});

然后,我在我的机器上启动了 cube.js 后端和他的页面 localhost:8000/kpi。出现 Error: Error: Cube 'Customs' not found for path 'Customs.count'Error: Error: Cube 'Customs' not found for path 'Customs.count'Error: Error: Can't find join path to join 'Users', 'Logs':

等错误

以前的开发者是这样定义他的 query.ts:

export const getQueryUserByType = (dateRange: any, granularity: any) => ({
  measures: ['Users.count'],
  dimensions: ['Users.localType'],
  timeDimensions: dateRange
    ? [
        {
          dimension: 'Logs.date',
          dateRange: dateRange,
          granularity,
        },
      ]
    : [
        {
          dimension: 'Logs.date',
          granularity,
        },
      ],
});

export const getQueryUserPageVist = (dateRange: any, granularity: any) => ({
  measures: ['Users.count'],
  dimensions: ['Logs.url'],
  timeDimensions: dateRange
    ? [
        {
          dimension: 'Logs.date',
          dateRange: dateRange,
          granularity,
        },
      ]
    : [
        {
          dimension: 'Logs.date',
          granularity,
        },
      ],
  filters: [
    {
      member: 'Logs.actionThetype',
      operator: 'equals',
      values: ['VisitPage'],
    },
  ],
});

export const getQueryCustomByApp = (dateRange: any, granularity: any) => ({
  measures: ['Customs.count'],
  dimensions: ['Customs.offerdisplayname'],
  timeDimensions: dateRange
    ? [
        {
          dimension: 'Customs.timestamp',
          dateRange: dateRange,
          granularity,
        },
      ]
    : [
        {
          dimension: 'Customs.timestamp',
          granularity,
        },
      ],
});

谁能告诉我 Error: Error: Cube 'Customs' not found for path 'Customs.count'Error: Error: Cube 'Customs' not found for path 'Customs.count'Error: Error: Can't find join path to join 'Users', 'Logs' 等错误是什么意思?我该如何修复它们?

您的应用程序缺少 Cube.js 架构,它是 Cube.js 部署的重要组成部分。您应该尝试找到这个丢失的源代码,或者根据您的仪表板 ui 应用程序重新开发它。

由于错误表明您缺少 Customs 多维数据集定义以及 UsersLogs 之间的连接定义。您可以在此处了解有关联接的更多信息:https://cube.dev/docs/joins