clickhouse
ModuleClickHouse: ClickHouse, its bulk-insert Formats and
FormattedInsertStatement, and the ASOF join AsofOperator.
ClickHouse extends the base builder directly (not the SQL dialects): it
adds PREWHERE, FINAL, SAMPLE, ARRAY JOIN, ASOF JOIN,
LIMIT ... BY, WITH FILL, SETTINGS, the -If conditional
aggregates, the approximate aggregates (quantile, uniq, topK, ...),
mutations (ALTER TABLE ... UPDATE / DELETE), FORMAT inserts and
named, typed placeholders ({param0:Int64}).
Contents
use utopia_query::builder::clickhouse::ClickHouseDialect;pub struct ClickHouseDialectThe ClickHouse dialect and its own state.
use utopia_query::builder::clickhouse::FormattedInsertStatement;pub struct FormattedInsertStatementAn INSERT INTO table [(columns)] FORMAT name envelope (no bindings),
with the format, the columns and, from Builder::bulk_insert, the
serialized rows to send with it.
It is a Statement (it derefs to one) with three more fields.
Deref.use utopia_query::builder::clickhouse::DeleteMode;pub enum DeleteModeWhich DELETE form Builder::delete emits.
pub type ClickHouse = Builder<ClickHouseDialect>A ClickHouse builder.
use utopia_query::Query;
use utopia_query::builder::ClickHouse;
let statement = ClickHouse::new()
.from("events", "")
.final_()
.sample(0.1)?
.prewhere([Query::equal("type", ["click"])])
.filter([Query::greater_than("count", 5)])
.build()?;
assert_eq!(
statement.query,
"SELECT * FROM `events` FINAL SAMPLE 0.1 PREWHERE `type` IN (?) WHERE `count` > ?"
);