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. Moose OLAP

Moose OLAP

Moose OLAP is MooseStack's schema-as-code layer for ClickHouse. It turns tables, views, and materialized views into typed objects your app can read from, write to, and evolve in code.

app/table.ts
import { OlapTable, ClickHouseEngines, LifeCycle } from "@514labs/moose-lib"; interface Record {  id: string;  name: string;  timestamp: Date;} export const table = new OlapTable<Record>("table", {  engine: ClickHouseEngines.MergeTree,  orderByFields: ["id"],  version: "0.0",  lifeCycle: LifeCycle.FULLY_MANAGED,});

Define your schema

  • Define tables in TypeScript or Python
  • Shape and precompute data with views and materialized views

Evolve or adopt an existing schema

  • Carry local schema changes forward to staging and production environments with schema migrations during development and planned migrations for remote environments
  • Work with existing ClickHouse tables and pull those schemas into your project when Moose is not the only system managing them

Read and write data

  • Query data from your application code or APIs through typed table and view objects
  • Insert data for ingestion flows, backfills, or batch writes

Get started

Choose the path that matches whether you're connecting to an existing ClickHouse deployment or starting a new Moose project.

Use existing ClickHouse
Connect Moose to your current ClickHouse setup and generate typed models around the schema you already have.
Open the guide →
Start from scratch
Define tables in TypeScript or Python and let Moose manage the ClickHouse schema lifecycle.
Model tables →
OLAP is usually already enabled

Most templates enable OLAP by default. If you have disabled it, turn features.olap back on in moose.config.toml before modeling tables or applying OLAP migrations.

Related resources

  • Use with Existing ClickHouse
  • External Tables
  • Syncing External Tables
  • Applying Migrations
  • Planned Migrations (OLAP)

On this page

Define your schemaEvolve or adopt an existing schemaRead and write dataGet startedRelated resources
Edit this page
FiveonefourFiveonefour
Fiveonefour Docs
MooseStackHostingTemplatesGuides
Release Notes
Source575
  • 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 Streams
  • Moose Workflows
  • Moose APIs & Web Apps
Deployment & Lifecycle
  • Moose Dev
  • Moose Migrate
  • Moose Deploy
Reference
  • API Reference
  • Query Layer
  • Testing Utilities
  • Data Types
  • Table Engines
  • CLI
  • Configuration
  • Observability Metrics
  • Help
  • Release Notes
Contribution
  • Documentation
  • Framework
app/table.ts
import { OlapTable, ClickHouseEngines, LifeCycle } from "@514labs/moose-lib"; interface Record {  id: string;  name: string;  timestamp: Date;} export const table = new OlapTable<Record>("table", {  engine: ClickHouseEngines.MergeTree,  orderByFields: ["id"],  version: "0.0",  lifeCycle: LifeCycle.FULLY_MANAGED,});