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

a semicolon in query is not handled correctly #310

Closed
pkit opened this issue Mar 4, 2024 · 3 comments
Closed

a semicolon in query is not handled correctly #310

pkit opened this issue Mar 4, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@pkit
Copy link

pkit commented Mar 4, 2024

client = clickhouse_connect.create_client()
result = client.query("SELECT 1;").result_set
print(result)
clickhouse_connect.driver.exceptions.DatabaseError: :HTTPDriver for http://localhost:8123 returned response code 400)
 Code: 62. DB::Exception: Syntax error (Multi-statements are not allowed): failed at position 9 (end of query) (line 1, col 9): ;
 FORMAT Native. . (SYNTAX_ERROR) (version 23.8.1.2992 (official build))
@pkit pkit added the bug Something isn't working label Mar 4, 2024
@genzgd
Copy link
Collaborator

genzgd commented Mar 4, 2024

That's a message returned by ClickHouse itself. Multiple SQL statements are not allowed over the HTTP interface, and semi-colons at the end are therefore rejected.

@genzgd genzgd closed this as completed Mar 4, 2024
@pkit
Copy link
Author

pkit commented Mar 4, 2024

Not really:

$ curl --data-binary 'SELECT 1;' http://localhost:8123/
1

@genzgd
Copy link
Collaborator

genzgd commented Mar 4, 2024

clickhouse-connect automatically adds a Format Native to the end of queries, so in theory the driver could strip off trailing semi-colons, but that seems fragile.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants