We value your privacy

This site uses cookies to improve your browsing experience, analyze site traffic, and show personalized content. See our Privacy Policy.

  1. MooseStack
  2. Data Types

Data Types

Moose supports a comprehensive set of ClickHouse column types across both TypeScript and Python. This section covers all supported types, their syntax, and how they map to ClickHouse.

Type Categories

Basic Types

  • Strings — String, LowCardinality(String), UUID
  • Integers — Int8 to Int64, UInt8 to UInt64
  • Floats — Float32, Float64
  • Decimals — Fixed-point Decimal(P,S)
  • Booleans — Boolean
  • Date & Time — Date, DateTime, DateTime64
  • Network — IPv4, IPv6

Complex Types

  • Arrays — Array(T)
  • Maps — Map(K, V)
  • Nested — Embedded objects
  • Tuples — Named tuples
  • Enums — Enumerated values
  • Geometry — Point, Ring, Polygon, etc.

Special Types

  • JSON — Dynamic and typed JSON columns
  • Nullable — Optional fields
  • Aggregates — SimpleAggregateFunction for pre-aggregation

Schema Features

  • Column Comments — Add descriptions to columns that appear in ClickHouse DDL

Quick Reference

CategoryTypeScriptPython
Stringstringstr
IntegerInt32, UInt64, etc.Annotated[int, "int32"]
FloatFloat32, Float64, numberfloat
Booleanbooleanbool
DateDate, DateTimedate, datetime
ArrayT[]List[T]
MapRecord<K, V>Dict[K, V]
Optionalfield?: TOptional[T]

Best Practices

  • Use specific integer types when you know the value ranges to save storage
  • Prefer Float64 for most floating-point calculations unless storage is critical
  • Use LowCardinality for string columns with repeated values (< 10,000 unique)
  • Choose appropriate DateTime precision based on your accuracy needs
  • Order columns by cardinality (low to high) for better compression
  • Add column comments to document field purposes in your schema

On this page

Type CategoriesBasic TypesComplex TypesSpecial TypesSchema FeaturesQuick ReferenceBest Practices
FiveonefourFiveonefour
Fiveonefour Docs
MooseStackHostingTemplatesGuides
Release Notes
Source531
  • Overview
Build a New App
  • 5 Minute Quickstart
  • Browse Templates
  • Existing ClickHouse
Add to Existing App
  • Next.js
  • Fastify
Fundamentals
  • Moose Runtime
  • MooseDev MCP
  • Language Server
  • Data Modeling
Moose Modules
  • Moose OLAP
  • Moose Streaming
  • Moose Workflows
  • Moose APIs & Web Apps
Deployment & Lifecycle
  • Moose Dev
  • Moose Migrate
  • Moose Deploy
Reference
  • API Reference
  • Data Types
  • Table Engines
  • CLI
  • Configuration
  • Observability Metrics
  • Help
  • Release Notes
Contribution
  • Documentation
  • Framework