-
Notifications
You must be signed in to change notification settings - Fork 98
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
Exposed method to control the readonly
query parameter
#181
base: main
Are you sure you want to change the base?
Exposed method to control the readonly
query parameter
#181
Conversation
@@ -58,7 +60,7 @@ impl Query { | |||
|
|||
/// Executes the query. | |||
pub async fn execute(self) -> Result<()> { | |||
self.do_execute(false)?.finish().await | |||
self.do_execute()?.finish().await |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As it is now set as true
by default, won't this fail with DDLs now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution; it makes sense, given that the read-only
param is hardcoded by default. Let's fix the logic (see the comment, CI also confirms that), add some more tests regarding enabled/disabled readonly
mode, and maybe an example illustrating the use case.
NB: failing MSRV CI check is supposed to be fixed after #180
At a second glance, would it make more sense just to make it so that |
Hey @slvrtrn.
Sure, I can check/extend tests and docs. But I’m just thinking if overwriting with 0 is the proper way to go, I mean including the Based on this code with hardcoded flag and this PR, I assume it will not overwrite it by default if it is already present in the options. |
Perhaps we can just remove |
Sure, this will work as well. Thanks. |
Summary
This PR is meant to improve the control over the readonly option sent by the client to the CH database. Right now, it is defined by some methods like
Query::do_execute
, but most of the public methods like Query::fetch,Query::fetch_one
, orQuery::fetch_all
don’t have control over this option. This makes it impossible to query the database with queries that contain a lot of columns and require temporary table creation on the database side, which results in the following error:By adding the changes in this PR, we will gain control over this option, making it possible to request data that requires the creation of temporary tables by CH.
Checklist