简体   繁体   中英

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.

I have seen this question: How to dynamically 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 .

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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