# profiles.yaml

The `profiles.yaml` file defines the Profiles semantic models using `models` and `var_groups`.

- `models` are defined by the `model_type` and consist of prepackaged SQL code that takes your inputs and runs it in your warehouse to output the defined views and tables.
- `var_groups` define `entity_var` and `input_var` used to define the [features]({{< ref "profiles/concepts/features.md" >}}) for [feature views]({{< ref "profiles/concepts/feature-views.md" >}}).

```yaml
models:
  <model-config>
var_groups:
  <var-group-config>
```

| Key | Description |
| :-------- | :---------- |
| [`model_config`](#models) <br/> <span style="color: #4D4DFF;font-size:12px;">Required</span> | Model configuration - see the specific [model](#models) for details. |
| [`var_group`]({{< ref "profiles/dev-docs/profiles-yaml/var-groups/" >}}) <br/> <span style="color: #4D4DFF;font-size:12px;">Required</span> | Configuration for the features. |

## Models

- [`identity_stitcher`]({{< ref "profiles/dev-docs/profiles-yaml/id-stitcher.md" >}})
- [`entity_cohort`]({{< ref "profiles/dev-docs/profiles-yaml/cohorts.md" >}})
- [`sql_template`]({{< ref "profiles/dev-docs/sql-model-yaml/sql-model-config.md" >}})
- [Data Apps]({{< ref "profiles/data-apps/_index.md" >}})

## Example

```yaml
models:
    - name: user_id_stitcher
        model_type: identity_stitcher
        model_spec:
            entity_key: user
            materialization:
               run_type: incremental
            edge_sources:
                - from: inputs/rsIdentifies
                - from: inputs/rsTracks
var_groups:
    name: user_features
    entity_key: user #Name as defined in the project file.
    vars:
        - entity_var:
          name: first_seen
          select: min(timestamp::date)
          from: inputs/rsTracks
          description: First user appearance
        - entity_var:
          name: last_seen
          select: max(timestamp::date)
          from: inputs/rsTracks
          is_feature: false
        - entity_var:
          name: user_lifespan
          select: '{{user.last_seen}} - {{user.first_seen}}'
          description: Lifespan of a user
```

