Skip to content

Reader

Reader(select, *, client=None, model=None, parameters=None, max_block_size=65536, settings=None, transport_settings=None)

Reads data from the ClickHouse database using a given query.

Initializes a new Reader instance.

Parameters:

Name Type Description Default
client Client | None

The ClickHouse client to use.

None
select Select

The query to execute.

required
model type[T] | None

Optional model to use for the response data.

None
parameters type[R] | None

Optional model to use for validating parameters.

None
max_block_size int

The maximum block size to use for streaming. Defaults to 65536.

65536
settings dict[str, Any] | None

The settings to use for the insert. Defaults to None.

None
transport_settings dict[str, str] | None

The transport settings to use for the insert. Defaults to None.

None

read_rows property

Returns the number of rows read from the database.

query(parameters=None) async

Executes the query and returns the results as a QueryResult.

stream(parameters=None) async

Executes the query and returns an AsyncGenerator