# Autogenerated semantic models
> Generate an Apache Ossie semantic model for an autogenerated data model, so AI agents and BI tools can query your tracking plan data correctly.
> Source: https://docs.snowplow.io/docs/modeling-your-data/automatically-generated-data-models/semantic-models/
> Documentation index: https://docs.snowplow.io/llms.txt

An autogenerated semantic model describes the table of an [autogenerated data model](/docs/modeling-your-data/automatically-generated-data-models/): what each row represents, which [event specification](/docs/event-studio/tracking-plans/event-specifications/) it belongs to, and what each column holds. It also defines an `event_count` metric for the table. AI agents and BI tools read it to write correct SQL against your data.

Snowplow generates it as an [Apache Ossie](https://github.com/apache/ossie) YAML document. Apache Ossie, formerly Open Semantic Interchange (OSI), is a vendor-neutral standard for describing datasets, fields, and metrics. You can use the same document with any tool that supports Ossie, either directly or through a converter.

> **Note: Available through AI tools only**
>
> You can generate autogenerated semantic models from [Snowplow Assistant](/docs/ai/console-agent/), or from any AI assistant connected to the [Snowplow MCP server](/docs/ai/snowplow-mcp/). Console doesn't have a semantic model option.

## Why use a semantic model

The warehouse stores your event data, but not its meaning. An agent querying the table sees column names such as `checkout_step_step_name`, with no way to know which rows are which business event or what the values stand for. A semantic model gives the agent that missing context.

Your [tracking plan](/docs/event-studio/tracking-plans/) already holds that information, in the event specification names, descriptions, and triggers, and in the property descriptions and allowed values of your [schemas](/docs/fundamentals/schemas/). The autogenerated semantic model takes that information and attaches it to the data model's table, where agents can read it.

Snowplow builds the autogenerated semantic model from the tracking plan and the stored data model configuration. None of the descriptions are written by AI. If a property has no description in its schema, its field has no description in the semantic model.

### What the autogenerated semantic model contains

Each part of the autogenerated semantic model comes from the tracking plan or the data model configuration:

| Semantic model part | Source                                                                                                                                                                                                                                         |
| ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Document name       | The tracking plan name.                                                                                                                                                                                                                        |
| Dataset             | The data model's table, named after the data model.                                                                                                                                                                                            |
| Dataset source      | The location of the table. For a view, Snowplow uses the location of the generated view. For a dbt model, or a view over a custom atomic events table, you provide the location. This includes every lake and Databricks volume destination.   |
| Dataset description | The data model description, followed by what a row is, how to read the event specification columns, and each event specification with its ID, description, and triggers.                                                                       |
| Fields              | One field per column of the data model, in the same order. Property fields use the schema property description and list allowed values from `enum`. Atomic fields use the [canonical event](/docs/fundamentals/canonical-event/) descriptions. |
| Time dimensions     | `date`, `time`, and `date-time` properties, plus atomic timestamps such as `derived_tstamp`.                                                                                                                                                   |
| Metrics             | `event_count`, the number of distinct `event_id` values.                                                                                                                                                                                       |

## Generate an autogenerated semantic model

Before you start, check that the tracking plan's events load into a Snowflake, BigQuery, Databricks, or lake destination. Redshift isn't supported. Your events also need the `event_specification` [entity](/docs/fundamentals/entities/), either from [Snowtype](/docs/event-studio/implement-tracking/) or from [event specification inference](/docs/event-studio/tracking-plans/event-specification-inference/).

Ask your assistant to create a data model and its semantic model for a tracking plan. For example:

```txt
Create a data model and semantic model for my "Checkout flow" tracking plan,
as a view on my Snowflake production destination.
```

The assistant creates the data model, shows you its SQL, and then generates the autogenerated semantic model for its table. Along the way, it asks whether your tracking code attaches the `event_specification` entity to every event. Your answer decides how the data model filters events. See [event specification inference](/docs/modeling-your-data/automatically-generated-data-models/#event-specification-inference).

The assistant can't run SQL in your warehouse. You'll need to run the data model SQL yourself, or add the dbt model to your project, before you load the semantic model.

You can also generate an autogenerated semantic model for an existing data model:

```txt
List the data models for my "Checkout flow" tracking plan, then give me
the semantic model for checkout_events.
```

For a dbt model, or a view over a custom atomic events table, tell the assistant the fully qualified name of the table:

```txt
Give me the semantic model for checkout_events. I materialized it with dbt
as analytics.snowplow_derived.checkout_events.
```

> **Note: Data models created before October 15, 2026**
>
> You can't generate an autogenerated semantic model from a data model created before October 15, 2026. Create a new data model for the tracking plan instead.

> **Note: Semantic models follow the stored data model**
>
> The data model SQL is a snapshot of the tracking plan when you created it. The autogenerated semantic model describes that snapshot. When the tracking plan changes, create a new data model, rebuild its table, and generate a new semantic model.

### Example autogenerated semantic model

This example is part of an autogenerated semantic model for a `Web Analytics` tracking plan, on Snowflake:

```yaml
version: 0.2.0.dev0
name: web_analytics
datasets:
- name: web_events
  source: analytics.atomic.web_events
  description: |-
    One row per event tracked for the 'Web Analytics' tracking plan.

    The event_specs column lists the event specifications recorded against a row by the event specification enrichment, and is empty when the enrichment is not enabled.

    Event specifications:

    - User workflow events (d00312cb-d1bd-42e4-9429-e7fefca14476)
  fields:
  - name: event_id
    expression:
      dialects:
      - dialect: SNOWFLAKE
        expression: event_id
    dimension:
      is_time: false
    description: A UUID for each event
    datatype: String
  - name: derived_tstamp
    expression:
      dialects:
      - dialect: SNOWFLAKE
        expression: derived_tstamp
    dimension:
      is_time: true
    description: Timestamp making allowance for inaccurate device clock
    datatype: DateTimeTz
  - name: user_workflow_step
    expression:
      dialects:
      - dialect: SNOWFLAKE
        expression: user_workflow_step
    dimension:
      is_time: false
    description: 'Allowed values: "new_poll", "option_added", "vote_added".'
    datatype: String
metrics:
- name: event_count
  expression:
    dialects:
    - dialect: SNOWFLAKE
      expression: count(distinct web_events.event_id)
  description: Number of events tracked for the 'Web Analytics' tracking plan.
  datatype: Integer
```

## Load the semantic model into your tools

How you load the autogenerated semantic model depends on the tool that reads it.

### Snowflake

Snowflake can create a semantic view directly from Apache Ossie YAML. Snowplow generates Ossie version `0.2.0.dev0`, and Snowflake supports version `0.1.1`. Change the first line of the YAML from `version: 0.2.0.dev0` to `version: 0.1.1`, then run:

```sql
CALL SYSTEM$CREATE_SEMANTIC_VIEW_FROM_OSSIE_YAML(
  'analytics.atomic',
  $$
version: 0.1.1
name: web_analytics
datasets:
  ...
  $$
);
```

The first argument is the database and schema where Snowflake creates the semantic view. Use the schema that holds the data model's table. Snowflake names the semantic view after the document `name`, here `web_analytics`, which comes from the tracking plan name.

You can also convert the YAML into Snowflake's native semantic view format with the [Apache Ossie converters](https://github.com/apache/ossie/tree/main/converters).

### Other tools

For Databricks metric views, Cube, Omni, and other tools, convert the YAML with the [Apache Ossie converters](https://github.com/apache/ossie/tree/main/converters). Each converter's documentation explains how to load the output.

## Ask questions about your data

Once your tool has loaded the semantic model, AI agents that use it, such as Snowflake Cortex Analyst, can answer questions about your data in natural language. The descriptions tell the agent which rows match each event specification, and which values a column can contain. How and when an agent uses the semantic model depends on the tool, so check its documentation.

Example questions for the `Web Analytics` tracking plan:

```txt
How many polls were created each day last week?
```

```txt
What share of users who created a poll went on to add a vote?
```

```txt
How many events were tracked for each workflow step last month?
```
