Skip to content

Raw result streaming

Oleg V. Kozlyuk edited this page Jul 3, 2020 · 1 revision

ClickHouse.Client allows to read data stream as sent by ClickHouse itself, for purposes of e.g. writing to a file. Example:

using var command = connection.CreateCommand();
command.Text = "SELECT * FROM system.numbers LIMIT 500 FORMAT JSONCompact";
using var result = await command.ExecuteRawResultAsync(CancellationToken.None);
using var stream = await result.ReadAsStreamAsync();
using var reader = new StreamReader(stream);
var json = reader.ReadToEnd();
Clone this wiki locally