cube.js 多租户模式使用一个说明

主要是关于多租户数据预聚合处理的

配置说明

module.exports = {
  contextToAppId: ({ authInfo }) => `CUBEJS_APP_${authInfo.myappid}`,
  // scheduledRefreshContexts should return array of objects, which can declare authInfo
  scheduledRefreshContexts: async () => [
    {
      authInfo: {
        myappid: "demoappid",
        u: {
          bucket: "demo"
        }
      }
    },
    {
      authInfo: {
        myappid: "demoappid2",
        u: {
          bucket: "demo2"
        }
      }
    }
  ]
};

说明

此问题官方已经在官方文档也说明了,我以前也写过一个简单的博客说明以及解决方法,同时0.25.33版本也增强了说明

参考资料

https://cube.dev/docs/multitenancy-setup#scheduled-refresh
https://cube.dev/docs/config#options-reference-scheduled-refresh-contexts
https://www.cnblogs.com/rongfengliang/p/14336290.html
https://github.com/cube-js/cube.js/issues/1904
https://github.com/cube-js/cube.js/releases/tag/v0.25.33

原文地址:https://www.cnblogs.com/rongfengliang/p/14350435.html