Maps store key-value pairs with specified key and value types.
interface User { preferences: Record<string, string>; // Map(String, String) metrics: Record<string, number>; // Map(String, Float64) settings: Record<string, boolean>; // Map(String, Boolean)}| ClickHouse Type | TypeScript | Python |
|---|---|---|
Map(String, String) | Record<string, string> | Dict[str, str] |
Map(String, Float64) | Record<string, number> | Dict[str, float] |
Map(String, Int64) | Record<string, Int64> | Dict[str, int] |
Map(String, Boolean) | Record<string, boolean> | Dict[str, bool] |
Map keys must be String, Int*, or UInt* types. String keys are most common.
Use Map when all values have the same type and you need efficient key lookups. Use JSON when values have mixed types or the structure is highly dynamic.