Moose lets you declare secondary/data-skipping indexes directly in your table definitions.
Moose generates the ClickHouse INDEX clauses on create and
plans ALTER TABLE ADD/DROP INDEX operations when you change them later.
minmax, Set(max_rows), ngrambf_v1(...), bloom_filter.from moose_lib import OlapTable, OlapConfigfrom moose_lib.blocks import MergeTreeEnginefrom pydantic import BaseModel class Events(BaseModel): id: str user: str message: str events_table = OlapTable[Events]( "Events", OlapConfig( engine=MergeTreeEngine(), order_by_fields=["id"], indexes=[ OlapConfig.TableIndex(name="idx_user", expression="user", type="minmax", granularity=1), OlapConfig.TableIndex(name="idx_message_ngrams", expression="message", type="ngrambf_v1", arguments=["3","256","1","123"], granularity=1), ], ),)INDEX ... entries inside CREATE TABLE.ALTER TABLE DROP INDEX <name> then ADD INDEX ... if the definition changed; pure adds/drops are applied as single operations.