Skip to content

fix(clickhouse): handle date parameters in WHERE clauses and format output dates - #310

Merged
letstri merged 5 commits into
mainfrom
fix/clickhouse-date-issue
Jan 26, 2026
Merged

fix(clickhouse): handle date parameters in WHERE clauses and format output dates#310
letstri merged 5 commits into
mainfrom
fix/clickhouse-date-issue

Conversation

@ifeelBALANCED

Copy link
Copy Markdown
Collaborator

Description of Changes

  • Added parseDateTime64BestEffort() wrapper for ISO date strings in query parameters to fix DateTime64 conversion errors
  • Configured date_time_output_format: 'iso' to return dates in ISO 8601 format

Fixes DateTime64 conversion errors when comparing dates in WHERE clauses.

Closes #309

@railway-app

railway-app Bot commented Jan 25, 2026

Copy link
Copy Markdown

This PR was not deployed automatically as @ifeelBALANCED does not have access to the Railway project.

In order to get automatic PR deploys, please add @ifeelBALANCED to your workspace on Railway.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes DateTime64 conversion errors in ClickHouse queries by automatically wrapping ISO date strings with parseDateTime64BestEffort() and configuring ClickHouse to output dates in ISO 8601 format.

Changes:

  • Added automatic detection and wrapping of ISO date strings in query parameters with parseDateTime64BestEffort()
  • Implemented SQL string escaping function to prevent injection vulnerabilities
  • Configured ClickHouse client to output dates in ISO format

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
apps/desktop/src/entities/connection/dialects/clickhouse/index.ts Adds escapeSqlString() helper and date detection logic to wrap ISO date strings with parseDateTime64BestEffort()
apps/desktop/electron/main/connections/clickhouse.ts Configures ClickHouse client with date_time_output_format: 'iso' setting

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread apps/desktop/src/entities/connection/dialects/clickhouse/index.ts Outdated
Comment thread apps/desktop/src/entities/connection/dialects/clickhouse/index.ts
Comment thread apps/desktop/src/entities/connection/dialects/clickhouse/index.ts

@Rudra-Sankha-Sinhamahapatra Rudra-Sankha-Sinhamahapatra left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a screen recording of if this problem has been solved or not @ifeelBALANCED

@Rudra-Sankha-Sinhamahapatra Rudra-Sankha-Sinhamahapatra changed the title fix(clickhouse): handle date parameters in WHERE clauses and format o… fix(clickhouse): handle date parameters in WHERE clauses and format output dates Jan 26, 2026
@ifeelBALANCED

Copy link
Copy Markdown
Collaborator Author

Can you add a screen recording of if this problem has been solved or not @ifeelBALANCED

2026-01-26.18.06.11.mov

@letstri
letstri merged commit 2327d24 into main Jan 26, 2026
2 checks passed
@letstri
letstri deleted the fix/clickhouse-date-issue branch January 26, 2026 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

error during conversion of string to type DateTime64

4 participants