clickhouse
Module[ClickHouse]: the ClickHouse schema.
Contents
use utopia_query::schema::clickhouse::ClickHouse;Rust
pub struct ClickHouseThe ClickHouse schema: backtick quoting, Nullable(...) /
LowCardinality(...) wrapping, engines with ORDER BY, PARTITION BY,
SAMPLE BY, TTL and SETTINGS, data-skipping indexes, codecs and
materialized views.
Rust
use utopia_query::schema::{ClickHouse, Engine, Schema};
let mut table = ClickHouse::new().table("events");
table.big_integer("id").unsigned().primary();
table.string("country", 255).low_cardinality();
table.datetime("at", 3);
table.engine(Engine::MergeTree, &[])?.partition_by("toYYYYMM(at)");
assert_eq!(
table.create()?.query,
"CREATE TABLE `events` (`id` UInt64, `country` LowCardinality(String), `at` DateTime64(3)) \
ENGINE = MergeTree() PARTITION BY toYYYYMM(at) ORDER BY (`id`)"
);Also implements
Debug.