Skip to content

select_all swallows exceptions for invalid queries or server errors #50

@ricardovj

Description

@ricardovj

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions