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 #1

Merged

Conversation

martijnthe
Copy link

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
Copy link
Author

"Copied" over this PR: kayak#803

@martijnthe martijnthe merged commit d3b7c0c into memfault:master May 27, 2024
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