Skip to main content
On this page

Kater SQL Language

Kater SQL reference

Every Kater addition to your warehouse's SQL: declarations, EVAL, joins, filters, functions, directives and parameters.

Audience
Data teams
Prerequisites
  • A Snowflake or DuckDB connection

Kater SQL is your warehouse’s own SQL with Kater’s additions. Write Snowflake SQL on a Snowflake connection and DuckDB SQL on a DuckDB connection: warehouse_type in connection.yaml sets the dialect, and the compiler refuses a function your warehouse does not have and says what to write instead. The additions are below.

Language

PageWhat it covers
File shapeHow a Kater SQL file holds its frontmatter and its statements, and what happens when you save it.
Addresses and namesHow a statement names a warehouse table, a dataset, a model, a workspace or a query, and the rules for each name.
JoinsRELATIONSHIP and REQUIRED_RELATIONSHIP, the named joins of Kater SQL.
Comment directivesThe comments that give a field its description, AI context, format, tags and business questions.
ParametersHow a query reads a value that a reader supplies, on Snowflake and on DuckDB.
What each model allowsWhich Kater SQL calls each kind of model, query and test can hold.

Functions

Each function has its own page, with its syntax, its arguments, what it returns, and an example with the rows that Kater gave. Kater SQL’s own calls come first:

FamilyWhat it covers
Field declarationsDIMENSION, MEASURE, CUSTOM_CALCULATION, NOT_ADDITIVE_ACROSS and EXCEL, which make new fields.
EVAL and its modifiersEVAL, which works out a measure, and CLEAR, REMOVE, SET, SET_CUSTOM and CURRENT, which change its context.
FiltersOPTIONAL_FILTER, which a reader switches on, and REQUIRED_FILTER, which always applies.
Calculation contextTOTAL, SHARE_OF_TOTAL, VALUE_FOR and the other calls that work a measure out again in another context.

A KATER__ function is a call that the compiler turns into your warehouse’s SQL. The menus write them for you, and you can write them yourself in any Kater SQL file. Each KATER__ function’s page also shows the SQL it compiles to.