FiveonefourFiveonefour
Fiveonefour Docs
MooseStackTemplatesGuides
Release Notes
Source514
  1. MooseStack
  2. Data Types
  3. Nested Types

On this page

UsageMultiple LevelsSee Also

Nested Types

Nested types allow embedding complex objects within table rows. Nested types store each field as a separate array column, which can impact query performance for high-throughput paths. Consider Named Tuples for simpler structures stored inline.

Usage

Define a separate model and use it as a field type.

class Address(BaseModel):    street: str    city: str    zip: str    country: str class User(BaseModel):    name: str    email: str    address: Address    # Nested type

Multiple Levels

Nested types can contain other nested types.

class Coordinates(BaseModel):    lat: float    lng: float class Address(BaseModel):    street: str    city: str    location: Coordinates    # Nested within nested class User(BaseModel):    name: str    address: Address
Nested vs JSON

Use nested types when the structure is known and fixed. Use JSON for dynamic or variable structures.

See Also

  • Tuples — Lightweight inline structured data
  • JSON — Dynamic or semi-structured data
  • ClickHouse Nested — ClickHouse official documentation
    • Overview
    Build a New App
    • 5 Minute Quickstart
    • Browse Templates
    • Existing ClickHouse
    Add to Existing App
    • Next.js
    • Fastify
    Fundamentals
    • Moose Runtime
    • MooseDev MCP
    • Data Modeling
    Moose Modules
    • Moose OLAP
    • Moose Streaming
    • Moose Workflows
    • Moose APIs & Web Apps
    Deployment & Lifecycle
    • Moose Migrate
    • Moose Deploy
    Reference
    • API Reference
    • Data Types
      • Strings
      • LowCardinality
      • Integers
      • Floats
      • Decimals
      • Booleans
      • Date & Time
      • Network
      • Arrays
      • Maps
      • Nested
      • Tuples
      • Enums
      • Geometry
      • JSON
      • Nullable
      • Aggregates
    • Table Engines
    • CLI
    • Configuration
    • Observability Metrics
    • Help
    • Release Notes
    Contribution
    • Documentation
    • Framework