Skip to content

Conversation

hawkyre
Copy link

@hawkyre hawkyre commented Jul 11, 2025

Some services don't allow large URLs (e.g. AWS when using ALBs has an 8k limit on the URL path), and since Ch always encodes params in the path, sending a large params payload causes them to reject the request.

This PR addresses this by accepting a new option :interpolate_params in Ch.query/4 which replaces the Clickhouse param placeholders with the properly encoded parameters. This is done by switching the placeholder for a casting expression using ::, so the return types are kept. Map types are a strange case so they are handled slightly differently. I also added a test for nested maps to ensure it works as intended.

To test this implementation, the best way to do it right now is to alter the conditions where the option is checked and run the tests. They all pass. If preferred, I can add a setting to optionally add this option to all queries or extra tests for this implementation, though for this to be worth it all queries should be tried with and without the option in my opinion.

@ruslandoga
Copy link
Contributor

ruslandoga commented Jul 11, 2025

👋

Thank you for the contribution!

I wonder if there are other options we could explore before going with interpolation. Like multipart forms.

@hawkyre
Copy link
Author

hawkyre commented Jul 11, 2025

Those are also sent inside the body, right? I believe this is what you mean
image

I can take a look into it

@hawkyre
Copy link
Author

hawkyre commented Jul 11, 2025

I made another PR with the multipart implementation for selects and non-binary inserts. The rest of the queries, such as streaming or inserts with binary data already get parsed in the body, so we shouldn't need to do anything special.

@hawkyre hawkyre closed this Aug 11, 2025
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.

2 participants