Compile GASP metrics into your engine's own format
compile_targetCompile mapped GASP metrics into Snowflake Cortex Analyst, Cube, or dbt MetricFlow files—models, views, and warehouse SQL—so your semantic layer can run them.
Instructions
Compile the GASP Standard metrics your mapping covers into the files of your semantic-layer engine. Takes the same input as compile_model (a GASP adapter, or an Ossie mapping with your semantic_model), compiles the metrics the same way and writes them in the engine's own format and your warehouse's SQL: target 'snowflake' gives a Cortex Analyst semantic model YAML (tables with database.schema.table base tables, time dimensions, dimensions, facts, relationships and the gasp_ metrics; loadable as a semantic view) plus staged_views.sql, the views the staged metrics read and the period spine table, to run first; target 'cube' gives a Cube data model, one cube per table with its joins, a dimension per field and the metrics as measures, plus one view joining the cubes from revenue_event; target 'dbt' gives a dbt project fragment for the MetricFlow semantic layer under models/gasp/, a model per table (with gasp_surrogate_key, the key columns as text joined with '_', where a snapshot is keyed by entity and date, since MetricFlow keys on one column), the sources, a semantic model per table with its entities, dimensions and measures, plus the metrics as simple, ratio or derived over those measures. A filtered aggregate is written as a CASE inside the aggregate, which every warehouse runs. Each staged table's query is the compiled source in the target dialect. Entries with unmapped pairs or no computable formula are listed and left out. Pass metrics or department for a subset.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"adapter": "<adapter>",
"target": "<target>"
},
"name": "compile_target"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| output | No | 'full' (default): the report followed by every file in a fenced block; 'files': the files alone, each under a ### <path> heading; 'report': the coverage and notes alone. | |
| target | Yes | The engine: 'snowflake' (Cortex Analyst semantic model YAML plus staged views SQL), 'cube' (Cube data-model directory) or 'dbt' (dbt MetricFlow models, semantic models and metrics). | |
| adapter | Yes | Your mapping as text: a GASP adapter (JSON; schema: https://gaspwiki.com/schemas/gasp-adapter-v1.json) or an Ossie mapping document (YAML or JSON). Check it with validate_mapping first. | |
| dialect | No | Cube and dbt: the SQL dialect of the measures, models and staged queries (postgres, snowflake, bigquery or databricks). Omit to use the adapter's warehouse, else postgres. The snowflake target always writes Snowflake SQL. | |
| metrics | No | Comma-separated metric names, abbreviations, aliases or formula ids to write (each resolved as in lookup_metric). Omit for every metric. | |
| database | No | Snowflake: the database prepended to schema.table sources, since a Cortex Analyst base table is database.schema.table. Cube does not need it. | |
| department | No | Write every metric of one department (e.g. 'Core'); combines with metrics. | |
| period_spine | No | The table of (period_start, period_end) rows the staged queries read, as named in your warehouse. Default gasp.period_spine. | |
| staged_schema | No | Snowflake: the schema the staged views are created in. Default: the schema of the first mapped table. | |
| semantic_model | No | With an Ossie mapping: your semantic model document (YAML or JSON), whose sources and field expressions the files read. |