Skip to content

Conversation

@vwency
Copy link
Contributor

@vwency vwency commented Nov 30, 2025

Summary

Closes #343

@vwency vwency changed the title feat(query): added Query::readonly method feat(query): added Query::readonly method Dec 15, 2025
}

/// Set read-only option for this query.
pub fn readonly(mut self, enabled: bool) -> Self {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strictly speaking, readonly is not a binary setting: https://clickhouse.com/docs/operations/settings/permissions-for-queries#readonly

This would be best represented by an enum like this:

pub enum ReadOnly {
    Disabled,
    Enabled,
    WithChangeSettings, // bikeshedding
}

You could make it possible to still pass a bool if you did something like this:

impl Query {
    pub fn readonly(mut self, readonly: impl Into<ReadOnly>) -> Self { ... }
}

impl From<bool> for ReadOnly {
    fn from(readonly: bool) -> Self {
        if readonly {
            Self::Enabled
        } else {
            Self::Disabled
        }
    }
}


* Optimize `RowCursor` by reusing buffer capacity where possible. ([#340])
* All `Query::fetch*` methods will always use POST instead of GET. It is now allowed to change `readonly` value via
`Query::with_option`. ([#342])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do not modify existing CHANGELOG entries; this will just confuse people trying to understand older releases because this does not exist in 0.14.1. You can either add a new entry under ## Unreleased or we will write one when cutting the release.

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.

Add Query::readonly setter

2 participants