Skip to content

fix(schema-compiler): Added templates.expressions.timestamp_literal for MySQL and DuckDB#10426

Open
pjleiwa6g wants to merge 2 commits intocube-js:masterfrom
pjleiwa6g:timestamp_value_not_between_quotes
Open

fix(schema-compiler): Added templates.expressions.timestamp_literal for MySQL and DuckDB#10426
pjleiwa6g wants to merge 2 commits intocube-js:masterfrom
pjleiwa6g:timestamp_value_not_between_quotes

Conversation

@pjleiwa6g
Copy link

Summary

When using TO_TIMESTAMP() in WHERE clause + aggregate function rewrite goes wrong -> timestamp value is not placed between quotes. Seen for MySQL and DuckDB as a source database.

Issue Reference this PR resolves
Fixes: Issue 10421

See issue 10421 to reproduce.

Description of Changes

Added to MysqlQuery.ts
templates.expressions.timestamp_literal = 'TIMESTAMP(\'{{ value | replace("T", " ") | replace("Z", "") }}\')';

Added to DuckDBQuery.ts
templates.expressions.timestamp_literal = '\'{{ value }}\'';

Overwrites setting in BaseQuery.js. Puts value in right format and places it between quotes.

Check List

  • Tests have been run in packages where changes have been made if available
  • Linter has been run for changed code
  • Tests for the changes have been added if not covered yet
  • Docs have been added / updated if required

… have timestamp between quotes and in thhe right format.
@pjleiwa6g pjleiwa6g requested review from a team as code owners February 24, 2026 07:51
@github-actions github-actions bot added javascript Pull requests that update Javascript code data source driver driver:duckdb pr:community Contribution from Cube.js community members. labels Feb 24, 2026
@pjleiwa6g pjleiwa6g changed the title Added templates.expressions.timestamp_literal for MySQL and DuckDB to… fix(schem-compiler): Added templates.expressions.timestamp_literal for MySQL and DuckDB Feb 24, 2026
@pjleiwa6g pjleiwa6g changed the title fix(schem-compiler): Added templates.expressions.timestamp_literal for MySQL and DuckDB fix(schema-compiler): Added templates.expressions.timestamp_literal for MySQL and DuckDB Feb 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

data source driver driver:duckdb javascript Pull requests that update Javascript code pr:community Contribution from Cube.js community members.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Timestamp value not between quotes when re-written (mysql, duckdb as source db)

1 participant