Supported Data Types
Viewing typescript
switch to python
The schema defines the names and data types of the properties in your Data Model. Moose uses this schema to automatically set up the data infrastructure, ensuring that only data conforming to the schema can be ingested, buffered, and stored.
Key<T>
Key[T: (str, int)] = T
The Key
type is specific to Moose and is used to define a primary key (opens in a new tab) in the OLAP storage table for your Data Model. If your Data Model requires a composite key, you can apply the Key
type to multiple columns.
Supported Data Types
Moose supports various data types for Data Models, as summarized in the table below:
Clickhouse | Typescript | Moose |
---|---|---|
String | String | ✅ |
Boolean | Boolean | ✅ |
Int64 | Number | ✅ |
Int256 | BigInt | ❌ |
Float64 | Number | ✅ |
Decimal | Number | ✅ |
DateTime | Date | ✅ |
Json | Object | ✅ |
Bytes | bytes | ❌ |
Enum | Enum | ✅ |
Array | Array | ✅ |
nullable | nullable | ✅ |
All Typescript number types are mapped to Float64
Clickhouse | Python | Moose |
---|---|---|
String | str | ✅ |
Boolean | bool | ✅ |
Int64 | int | ✅ |
Int256 | int | ❌ |
Float64 | float | ✅ |
Decimal | float | ✅ |
DateTime | datetime | ✅ |
Json | dict | ❌ |
Bytes | bytes | ❌ |
Array | list[] | ✅ |
nullable | Optional[T] | ✅ |
If you do not specify a Key
type, you must set up a DataModelConfig
to specify the properties that will be used for the order_by_fields
. Learn more about DataModelConfig.