Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support of SETTINGS ClickHouse clause #803

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

martijnthe
Copy link

@martijnthe martijnthe commented May 14, 2024

Summary

Clickhouse SQL has an optional SETTINGS clause with SELECTs which can be used to configure all kinds of options.

This PR adds a settings method to ClickHouseQueryBuilder to add these options to a SELECT query.

All current (Clickhouse 24.4) settings keys are snake-case. Therefore I opted to use the settings keys directly as kwargs to the settings method, allowing passing multiple settings pairs in one call in a Pythonic/ideomatic way.

Test Plan

Added a unit test to exercise the new function.

 ### Summary

Clickhouse SQL has an optional [`SETTINGS` clause](settings-clause) with
`SELECT`s which can be used to configure [all kinds of options](settings).

This PR adds a `settings` method to `ClickHouseQueryBuilder` to add these
options to a `SELECT` query.

All current (Clickhouse 24.4) settings keys are snake-case. Therefore I opted
to use the settings keys directly as kwargs to the `settings` method, allowing
passing multiple settings pairs in one call in a Pythonic/ideomatic way.

[settings-clause]: https://clickhouse.com/docs/en/sql-reference/statements/select#settings-in-select-query
[settings]: https://clickhouse.com/docs/en/operations/settings/settings

 ### Test Plan

Added a unit test to exercise the new function.
@martijnthe martijnthe requested a review from a team as a code owner May 14, 2024 13:32
@martijnthe
Copy link
Author

cc @AzisK -- tagging you because you reviewed a very similar PR (#707). Thanks for looking!

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