How to use @cubejs-backend/schema-compiler - 2 common examples

To help you get started, we’ve selected a few @cubejs-backend/schema-compiler examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cube-js / cube.js / packages / cubejs-server-core / core / CompilerApi.js View on Github external
async getCompilers() {
    let compilerVersion = (
      this.schemaVersion && this.schemaVersion() ||
      'default_schema_version'
    ).toString();
    if (this.options.devServer) {
      const files = await this.repository.dataSchemaFiles();
      compilerVersion += `_${crypto.createHash('md5').update(JSON.stringify(files)).digest("hex")}`;
    }
    if (!this.compilers || this.compilerVersion !== compilerVersion) {
      this.logger(this.compilers ? 'Recompiling schema' : 'Compiling schema', { version: compilerVersion });
      // TODO check if saving this promise can produce memory leak?
      this.compilers = PrepareCompiler.compile(this.repository, {
        allowNodeRequire: this.allowNodeRequire
      });
      this.compilerVersion = compilerVersion;
    }
    return this.compilers;
  }
github cube-js / cube.js / packages / cubejs-server-core / core / CompilerApi.js View on Github external
createQuery(compilers, dbType, query) {
    return QueryBuilder.query(
      compilers,
      dbType, {
        ...query,
        externalDbType: this.options.externalDbType,
        preAggregationsSchema: this.preAggregationsSchema,
        allowUngroupedWithoutPrimaryKey: this.allowUngroupedWithoutPrimaryKey
      }
    );
  }

@cubejs-backend/schema-compiler

Cube schema compiler

Apache-2.0
Latest version published 6 days ago

Package Health Score

89 / 100
Full package analysis