Skip to content

fix: DBeaver 25+ compat, add native ClickHouse HTTP driver#22

Open
mason-respark wants to merge 2 commits intosrthkdev:mainfrom
mason-respark:fix/dbeaver-26-cli-and-native-clickhouse
Open

fix: DBeaver 25+ compat, add native ClickHouse HTTP driver#22
mason-respark wants to merge 2 commits intosrthkdev:mainfrom
mason-respark:fix/dbeaver-26-cli-and-native-clickhouse

Conversation

@mason-respark
Copy link
Copy Markdown

Summary

DBeaver 25 removed the -o and -of CLI flags that executeViaCli (the fallback used for drivers without a native implementation) and exportData both rely on. On DBeaver 25+ those flags are silently ignored — DBeaver opens the UI, connects to the datasource, and never exits — so every query through the CLI fallback times out at 30 s (DBeaver execution timed out after 30000ms), and export_data hits the same hang. Drivers routed through the fallback (Oracle, ClickHouse pre-patch, etc.) are effectively broken on DBeaver 25+.

Verified repro on DBeaver 26.0.3 against a ClickHouse datasource: every test_connection / execute_query fails with the timeout above. The dbeaver-help allow-list no longer contains -o or -of, and DBeaver prints Parameter(s) -o -of csv cannot be specified after 'dbeaver' to its debug log before falling through to the UI.

Changes

  • Add a native ClickHouse driver using the ClickHouse HTTP interface (default_format=JSON). TLS is selected when ssl=true is set on the DBeaver connection or when the port is 443/8443. Auth via X-ClickHouse-User / X-ClickHouse-Key headers. Handles the clickhouse-ssl handler block and the nested properties.properties.ssl layout that DBeaver writes into data-sources.json.
  • Remove the DBeaver CLI query fallback (executeViaCli, executeCli, isCliAvailable, parseCSVOutput, cleanupFiles). Unsupported drivers now fail fast with a clear error listing the natively supported drivers (PostgreSQL + compatibles, MySQL/MariaDB, MSSQL, SQLite, ClickHouse) instead of hanging for the full timeout.
  • Route exportData through the native drivers. CSV/JSON is produced in-process via the existing convertToCSV helper, so export no longer depends on the broken CLI path.
  • Drop the unused executablePath field and the csv-parser usage in workspace-client.ts. The constructor's first parameter is preserved (as _executablePath) so existing callers that pass it continue to compile.

Net code delta: +135 / −180 lines (dead CLI plumbing removed).

Test plan

  • npm run typecheck passes
  • npm run lint passes
  • npm test — 49 tests pass (was 43; added 6 new for workspace-client.test.ts)
  • New tests cover: ClickHouse URL/auth construction, HTTPS auto-detect by port, explicit SSL disable, error-body surfacing, DDL empty-body handling, fail-fast error for unsupported drivers.
  • End-to-end verified against a real DBeaver 26.0.3 workspace with ClickHouse (HTTPS:443), MySQL 8, and two PostgreSQL connections. All four resolve test_connection and SELECT 1 successfully after the patch; all four timed out at 30 s before it (MySQL/Postgres were only unaffected because they already had native branches — the ClickHouse connection was the original repro).
  • Unsupported driver (synthetic oracle_thin) now throws Database driver "oracle_thin" is not supported... immediately instead of hanging.

Notes

  • The CHANGELOG gets an [Unreleased] block; happy to land under a specific version header instead if you prefer.
  • The full DatabaseConnection.properties type is Record<string, string> today, but the clickhouse-ssl handlers block is an object. The ClickHouse driver reads through a pair of unknown casts for that case — matches how the existing Postgres branch handles handlers.postgre_ssl.
  • No new runtime dependencies; fetch is built-in on Node ≥18, which is already the minimum in engines.node.

Mason Short added 2 commits April 24, 2026 14:52
DBeaver 25 removed the `-o` and `-of` CLI flags that the CLI fallback
in `executeViaCli` (and `exportData`) relied on. On DBeaver 25+, those
flags are silently ignored — DBeaver opens the UI, connects, and never
exits — so every query through the CLI fallback timed out at 30s
(`DBeaver execution timed out after 30000ms`). Drivers routed through
this path (Oracle, ClickHouse, etc.) were effectively broken.

Changes:

- Add a native ClickHouse branch using the ClickHouse HTTP interface
  (`default_format=JSON`). TLS is selected when `ssl=true` is set on the
  DBeaver connection or when the port is 443/8443. Auth via
  `X-ClickHouse-User` / `X-ClickHouse-Key` headers. Works with the
  `clickhouse-ssl` handler block and nested `properties.properties.ssl`
  that DBeaver writes into `data-sources.json`.
- Remove the DBeaver CLI query fallback (`executeViaCli`, `executeCli`,
  `isCliAvailable`, `parseCSVOutput`, `cleanupFiles`). Unsupported
  drivers now fail fast with a clear error listing the natively
  supported drivers instead of hanging for the full timeout.
- Route `exportData` through the native drivers and convert to CSV/JSON
  in-process, so export is no longer dependent on the broken CLI path.
- Drop unused `executablePath` field and the `csv-parser` usage. The
  constructor's first parameter is preserved (as `_executablePath`) so
  existing callers that pass it continue to compile.

Tests: new `tests/workspace-client.test.ts` covers ClickHouse URL/auth
construction, HTTPS auto-detection by port, explicit SSL disable,
error-body surfacing, DDL empty-body handling, and the fail-fast error
for unsupported drivers.

Verified end-to-end against a real DBeaver 26.0.3 workspace with
ClickHouse (HTTPS), MySQL, and PostgreSQL connections — all four
datasources resolve `test_connection` and `SELECT 1` successfully.
`test_connection` on a ClickHouse datasource fell through to the generic
`SELECT 1;` test query, so `databaseVersion` was reported as "1" rather
than the real server version. Add a ClickHouse branch that mirrors the
existing Postgres/MySQL pattern.
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.

1 participant