The Moose OLAP module 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.
In TypeScript, you must export all primitives (tables, views, etc.) for Moose to discover them. For example: export { myTable }
import { Key, OlapTable } from "@514labs/moose-lib"; interface MyFirstTable { id: Key<string>; name: string; age: number;} // Create a table named "first_table"export const myTable = new OlapTable<MyFirstTable>("first_table");If you're new to Moose OLAP, choose one of these paths:
moose init your-project-name --from-remoteCreate a blank project, then model your first table:
moose init your-project-name --language <typescript|python>
cd your-project-nameWorking with ClickPipes/PeerDB? Read External Tables and keep them in sync with DB Pull.
In your moose.config.toml file, enable the OLAP Database capability:
[features]olap = trueJSON, LowCardinality, Nullable, etc)These capabilities are available from other MooseStack modules or even from your own client applications:
You can connect to your ClickHouse instance with your favorite database client. Your credentials are located in your moose.config.toml file:
[clickhouse_config]db_name = "local"user = "panda"password = "pandapass"use_ssl = falsehost = "localhost"host_port = 18123native_port = 9000These are the default credentials for your local ClickHouse instance running in dev mode.
Although designed to work independently, Moose OLAP can be combined with other modules to add additional capabilities surrounding your database: