Core schema compiler for Cube.js (v0.33.8), the analytics API platform. This package transforms Cube.js data schema definitions (data model files) into executable SQL queries. It compiles SQL for various databases (Postgres, BigQuery, MySQL, etc.) and supports pre-aggregations, joins, dimensions, measures, and time granularities. Weekly releases under the Cube.js monorepo. Key differentiator: provides an ORM-like layer for analytics SQL generation, enabling complex analytical queries (funnels, retention) without writing raw SQL. Fully typed with TypeScript. Requires Cube.js backend server for execution.
npm install cubejs-schema-compilerNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to instantiate SchemaCompiler, define a cube schema, and compile it to an SQL query.
Upgrade to Node.js 12+ (prefer 14 or 16).
Use 'sql' alias or custom SQL expressions instead.
Use `await compiler.compile(schema)` or handle promise.
Set `"esModuleInterop": true` in tsconfig.json.
Pass `dataSource` in the constructor options.
Export `module.exports = { cubes: [...] }`.Explicitly set `refreshKey` in pre-aggregations if old behavior needed.
Use `const result = await compiler.compile(schema);`
Ensure the `dataSource` option matches a configured data source in Cube.js config.
Use `module.exports = { cubes: [...] };` instead of `export default { cubes: [...] };`