clickhouse.rs icon indicating copy to clipboard operation
clickhouse.rs copied to clipboard

Add support for raw queries without going through query builder

Open slvrtrn opened this issue 6 months ago • 2 comments

Description

Support for raw queries (without going through the query builder) is missing — ? must be escaped as ?? even when no arguments are used and so on. This can be annoying if a custom query builder is used.

Implementation

This part:

https://github.com/ClickHouse/clickhouse-rs/blob/v0.13.3/src/query.rs#L30-L34

can be made lazy + a builder method that alters the builder behavior, or we can just add Query::raw or Query::new_raw that just uses the query string as-is, which is simpler.

slvrtrn avatar Jun 13 '25 09:06 slvrtrn

Would it make sense to add a dedicated test file (for example, query_raw.rs)? Modifying the builder method directly might be easier test wise

ozgurcancal avatar Jun 16 '25 07:06 ozgurcancal

Would it make sense to add a dedicated test file (for example, query_raw.rs)?

Yes, sure. Would you like to contribute?

slvrtrn avatar Jun 16 '25 15:06 slvrtrn