cube-js/cube · error · Error

Not implemented

Error message

Not implemented

What it means

convertTz(field) renders the SQL expression that converts a timestamp into the query's timezone. BaseQuery declares it abstract and throws 'Not implemented'; every concrete adapter must override it. Hitting this error means the code path ran against BaseQuery (or a subclass) that never implemented timezone conversion.

Source

Thrown at packages/cubejs-schema-compiler/src/adapter/BaseQuery.js:4124

   */
  timestampFormat() {
    return 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]';
  }

  /**
   * @return {number}
   */
  timestampPrecision() {
    return 3;
  }

  /**
   * @param {string} field
   * @return {string}
   */
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
  convertTz(field) {
    throw new Error('Not implemented');
  }

  /**
   * URL-encode a SQL expression. Override in dialect-specific query classes
   * for native URL encoding support. Default implementation uses REPLACE
   * chains for the most common characters.
   * @param {string} sql
   * @return {string}
   */
  urlEncode(sql) {
    return `REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(CAST(${sql} as TEXT), '%', '%25'), '&', '%26'), '=', '%3D'), '+', '%2B'), ' ', '%20')`;
  }

  /**
   * @param {string} granularity
   * @param {string} dimension
   * @return {string}
   */

View on GitHub (pinned to 7d981676b3)

Solutions

  1. Implement convertTz(field) in your adapter's query class to emit dialect-specific tz conversion SQL
  2. If no timezone conversion is desired, override to return the field as-is (document the caveat)
  3. Check you are instantiating the correct concrete query class, not BaseQuery directly

Example fix

// before (custom adapter)
class MyQuery extends BaseQuery {} // convertTz missing
// after
class MyQuery extends BaseQuery {
  convertTz(field) { return `timezone('${this.timezone}', ${field})`; }
}
Defensive patterns

Strategy: try-catch

Validate before calling

const q = adapter.createQuery({});
if (q.convertTz === BaseQuery.prototype.convertTz) {
  throw new Error('Adapter must implement convertTz before serving timezone-aware queries');
}

Type guard

function implementsConvertTz(adapter) {
  return typeof adapter.convertTz === 'function' &&
    adapter.convertTz !== BaseQuery.prototype.convertTz;
}

Try / catch

try { return await cube.load(query); } catch (e) {
  if (e.message === 'Not implemented' && stackIncludesConvertTz(e)) {
    throw new Error('Data source adapter lacks timezone conversion support');
  }
  throw e;
}

Prevention

When it happens

Trigger: Compiling SQL involving timestamp granularity or timezone-aware dimensions using a query class that inherits BaseQuery.convertTz without overriding it (or a custom adapter forgot the override).

Common situations: Writing a custom data source driver based on BaseQuery and missing the convertTz override; queries that include timeDimensions triggering tz conversion on an incomplete custom dialect.

Related errors


AI-assisted analysis of cube-js/cube@7d981676b3 (2026-09-02). Data as JSON: /api/errors/bcc23484e835dcbc. Report an issue: GitHub.