简体   繁体   English

动态动态模式

[英]On The Fly Dynamic Schemas

I am looking through Dynamic Cube Creation and was wondering - is there a way to get a cube created post Cube process startup?我正在查看 动态多维数据集创建并想知道 - 有没有办法在多维数据集进程启动后创建多维数据集?

In this use case, we have multiple schemas being created on the fly as users navigate through a front end app, and, will need to have some cubes created when those schemas are created.在这个用例中,我们在用户浏览前端应用程序时动态创建了多个模式,并且在创建这些模式时需要创建一些多维数据集。 Initially, the search began for a Cube endpoint to allow the creation of cubes, but, it doesn't seem to be out there.最初,搜索开始于 Cube 端点以允许创建多维数据集,但它似乎并不存在。

I have seen this question: How to dynamically generate schema for cube.js?我见过这个问题: How to dynamic generate schema for cube.js? , but, I don't see how it could work for the above use case, and, in the selected answer, there is a mention of a tenant-by-tenant basis, which, we are not in need of. ,但是,我看不出它如何适用于上述用例,并且在选定的答案中,提到了逐个租户的基础,这是我们不需要的。

It's possible to trigger an update on the compilation of schemas.可以触发模式编译的更新。 Take a look at Schema Versioning .看看Schema 版本控制

module.exports = {
  schemaVersion: async ({ securityContext }) => {
    const schemaVersions = await (
      await fetch('http://your-api-endpoint/schemaVersion')
    ).json();

    return schemaVersions['version'];
  },
};

Basically, you need to do a version increment every time the underlying data schema has changed.基本上,每次底层数据模式发生变化时,您都需要进行版本增量。 I modified the example from the docs removing multitenancy just to show how you would have to create the response from your API.我修改了删除多租户的文档中的示例,只是为了展示如何从 API 创建响应。

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

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