ClickHouse / ClickHouse/clickhouse-java
Query Parameters Refactor
- Dominant language
- Java
- Stars
- 1.6k
- Forks
- 636
- Avg merge
- 2d 16h
- Merged PRs (30d)
- 28
Description
**Description:**
In the current implementation, clickhouse-java manually parses query parameters, supporting both traditional question marks and named parameters. We propose refactoring this process to leverage ClickHouse's [parameters binding capabilities](https://clickhouse.com/docs/en/sql-reference/syntax#defining-and-using-query-parameters) for a more streamlined and efficient parameter parsing.
This refactoring aligns with the methods used by other connectors, including:
- [Python client](https://github.com/ClickHouse/clickhouse-connect/blob/6928aed5845c944007b6bf93e806313a96a93fbc/clickhouse_connect/driver/query.py#L370)
- [JS client](https://github.com/ClickHouse/clickhouse-js/blob/bc310bb529763d503ec75609d2b569956ad3b73f/packages/client-common/src/utils/url.ts#L65)
- [Go client](https://github.com/ClickHouse/clickhouse-go/blob/main/query_parameters.go#L33)
All of these clients have comprehensive test suites ([Python](https://github.com/ClickHouse/clickhouse-connect/blob/99681d98eeb2106a54c298a6d320906977d3e4cc/tests/integration_tests/test_params.py), [JS](https://github.com/ClickHouse/clickhouse-js/blob/927ca276d4d41d44e6b36b4315c5143a3467258a/packages/client-common/__tests__/unit/format_query_params.test.ts), and [Go](https://github.com/ClickHouse/clickhouse-go/blob/main/tests/query_parameters_test.go)) that can serve as valuable references for testing the proposed refactoring.
Contributor guide
Assessment
This issue has not been assessed yet.