【问题标题】:Cube.js: Can't find join path to joinCube.js:找不到要加入的加入路径
【发布时间】:2020-02-19 20:31:56
【问题描述】:

我正在接管一个网站。我再也联系不到以前的开发者了。他决定使用 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' 之类的错误是什么意思?我该如何解决它们?

【问题讨论】:

    标签: sql mongodb cube.js


    【解决方案1】:

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

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

    【讨论】:

      猜你喜欢
      • 2021-05-18
      • 2017-02-23
      • 2013-04-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多