Moose Stack

Moose OLAP

OLAP Database

Viewing:

Overview

The OLAP Database capability provides standalone ClickHouse database management with type-safe schemas. You can use this capability independently to create tables, materialized views, and manage your table schemas without requiring other MooseStack components.

Enabling OLAP Database

In your moose.config.toml file, enable the OLAP Database capability:

[features]
olap = true

Basic Example

FirstTable.ts
interface MyFirstTable {
  id: Key<string>;
  name: string;
  age: number;
}
 
// Create a table named "first_table"
const myTable = new OlapTable<MyFirstTable>("first_table");

Core Capabilities

  • Model tables and views with TypeScript or Python
  • Automatic type mapping and support for advanced ClickHouse column types (e.g JSON, LowCardinality, Nullable, etc)
  • Create tables and views with one line of code
  • In-database transformations/materialized views
  • Migrations and schema evolution
  • Query with templated SQL strings and type-safe table and column references
  • Bulk insertion with failure handling and runtime validation

Managing your database

Tables

OLAP Tables

Define and create ClickHouse tables with type-safe schemas
Materialized Views

Materialized Views

Pre-compute and store query results for faster analytics
Data Modeling

Schema Optimization

Schema design best practices to optimize your queries
Migrations

Dynamic Migrations

Always keep your code and database in sync with dynamic migrations

Accessing your data

These capabilities are available from other MooseStack modules or even from your own client applications:

Connecting to your ClickHouse instance

You can connect to your ClickHouse instance with your favorite database client. Your credentials are located in your moose.config.toml file:

moose.config.toml
[clickhouse_config]
db_name = "local"
user = "panda"
password = "pandapass"
use_ssl = false
host = "localhost"
host_port = 18123
native_port = 9000

Default Credentials

These are the default credentials for your local ClickHouse instance running in dev mode.

Combining with other modules:

Although designed to work independently, Moose OLAP can be combined with other modules to add additional capabilities surrounding your database:

  • Combine with Streaming and APIs to setup streaming ingestion into ClickHouse tables
  • Combine with Workflows to build ETL pipelines and data transformations
  • Combine with APIs to expose your ClickHouse queries to client applications via REST API