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

select_all swallows exceptions for invalid queries or server errors #50

Open
ricardovj opened this issue Apr 4, 2024 · 1 comment
Open

Comments

@ricardovj
Copy link

ricardovj commented Apr 4, 2024

Is there a way to expose the exceptions and allow callers to capture and handle appropriately? Right now running a select_all on a rogue query quietly fails saying it got 0 results, as opposed to fail because of a logic error:

Simple steps to reproduce from the rails console:

>> # This should cause an exception as the function ccccccc() doesn't exist
>> ClickHouse.connection.select_all("SELECT ccccccc() from cccccccxxxxxx")

SQL (Total: 104MS, CH: 0MS)� SELECT ccccccc() from cccccccxxxxxx;�
Read: 0 rows, 0B. Written: 0 rows, 0B
[]

>> ClickHouse.connection.select_all("SELECT now()")

SQL (Total: 171MS, CH: 1MS)� SELECT now();�
Read: 1 rows, 1.0B. Written: 0 rows, 0B
[{"now()"=>2024-04-04 17:25:04 -0400}]

The exception is there in the faraday.body, but when converting to a ResultSet in the ClickHouse::Response::Factory.response() method that exception is never checked.

image

@ricardovj
Copy link
Author

ricardovj commented Jun 4, 2024

Any updates on this @shlima?

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

No branches or pull requests

1 participant