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

Error running SET Statement #59

Closed
DerekChia opened this issue Oct 20, 2022 · 3 comments · Fixed by #60
Closed

Error running SET Statement #59

DerekChia opened this issue Oct 20, 2022 · 3 comments · Fixed by #60
Assignees

Comments

@DerekChia
Copy link

SET Statement assigns value to the param setting for the current session, using the following syntax

SET param = value

However, when using it with client.query(), we get the following error.

client.query('SET input_format_csv_use_best_effort_in_schema_inference=0')
HTTPDriver url https://xxx.us-west-2.aws.clickhouse.cloud:8443/ returned response code 400)
Code: 62. DB::Exception: Syntax error: failed at position 61 ('FORMAT') (line 2, col 2): FORMAT Native. Expected end of query. (SYNTAX_ERROR) (version 22.10.1.15995 (official build))

Is there a way to get this to work, especially for those that cannot be placed as part of the query statement but needs to be enabled beforehand? e.g. SET allow_experimental_X=1

@genzgd
Copy link
Collaborator

genzgd commented Oct 20, 2022

SET statements should be run using the client.command method and that should work. But it makes sense to check for them in the query method and not apply a format, so I'll see if I can improve that.

@genzgd genzgd self-assigned this Oct 20, 2022
@genzgd
Copy link
Collaborator

genzgd commented Oct 20, 2022

Also a SET statement requires that get_client be created with a session_id.

@genzgd genzgd linked a pull request Oct 20, 2022 that will close this issue
@genzgd genzgd closed this as completed Oct 20, 2022
@genzgd
Copy link
Collaborator

genzgd commented Oct 20, 2022

Release 0.3.2 also sets a session_id by default.

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 a pull request may close this issue.

2 participants