Clickhouse Utils
This crate provides a set of utilities for working with Clickhouse.
Features
- fastnum: Enable support for Fastnum D256.
Usage
Migration
create a migrations folder in your project and add your migrations files. Example:
migrations/
├── 0001_create_users_table.sql
└── 0002_add_email_column.sql
Run the migrations:
async
Serde
Serialize and Deserialize common types for Clickhouse.
- Std Hashmap of <String, String>
- Fastnum : any decimals with a fix size scale mandated by the clickhouse schema
Examples
use HashMap;
use ;
use D256;
For the decimal fastnum::D256, we use:
- Decimal with { 256 / 64 } or Uint<4>
- 25 decimals, that should corelate with you clickhouse schema
The database schema used:
(
decimal Decimal256(25),
attributes Map(String, String),
) ENGINE = MergeTree
ORDER BY (decimal)