简体   繁体   English

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

[英]Cube.js: Can't find join path to join

I'm taking over a website.我要接管一个网站。 I could not reach the previous developer anymore.我无法再联系到以前的开发人员。 He decided to use cube.js and once showed me a working KPI page with charts.他决定使用cube.js,并有一次向我展示了一个带有图表的有效KPI 页面。 Now, I'm trying to make the page work on my side, and understand what he did.现在,我试图让页面在我这边工作,并了解他做了什么。

I have installed cube.js on my machine.我已经在我的机器上安装了 cube.js。 The collections in our database are comments , folders , logs , posts , sessions , subscribers , users .我们数据库中的集合是commentsfolderslogspostssessionssubscribersusers I used cubejs generate -t users and cubejs generate -t logs to generate Users.js and Logs.js .我使用了cubejs generate -t userscubejs generate -t logs来生成Users.jsLogs.js For example, here is the generated Users.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`
    }
  }
});

Then, I launched cube.js backend and his page localhost:8000/kpi on my machine.然后,我在我的机器上启动了 cube.js 后端和他的页面localhost:8000/kpi There are errors like Error: Error: Cube 'Customs' not found for path 'Customs.count' , Error: Error: Cube 'Customs' not found for path 'Customs.count' and Error: Error: Can't find join path to join 'Users', 'Logs' :有类似Error: Error: Cube 'Customs' not found for path 'Customs.count'Error: Error: Cube 'Customs' not found for path 'Customs.count' 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'

在此处输入图片说明

Here is how the previous developer defined his query.ts :这是以前的开发人员如何定义他的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,
        },
      ],
});

Could anyone tell What errors like Error: Error: Cube 'Customs' not found for path 'Customs.count' , Error: Error: Cube 'Customs' not found for path 'Customs.count' and Error: Error: Can't find join path to join 'Users', 'Logs' mean?谁能告诉类似Error: Error: Cube 'Customs' not found for path 'Customs.count' Error: Error: Cube 'Customs' not found for path 'Customs.count'Error: Error: Cube 'Customs' not found for path 'Customs.count' 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'是什么意思? How could I fix them?我怎么能修复它们?

Your application is missing Cube.js schema which is essential part of Cube.js deployment.您的应用程序缺少 Cube.js 架构,这是 Cube.js 部署的重要组成部分。 You either should try to find this missing source code or redevelop it based on your dashboard ui application.您应该尝试找到这个缺失的源代码,或者根据您的仪表板 ui 应用程序重新开发它。

As errors state you're missing Customs cube definition as well as join definition between Users and Logs .由于错误状态,您缺少Customs多维数据集定义以及UsersLogs之间的连接定义。 You can learn more about joins here: https://cube.dev/docs/joins您可以在此处了解有关连接的更多信息: https : //cube.dev/docs/joins

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM