Skip to main content

What is a Transform Model?

A model in Transform is the complete representation of the configurations of your data sources and metrics that you commit to Transform. When you change your data source configuration or metrics in Transform, you create a new version of the Transform Model.

Which model will my metrics be created from?

Your Transform server will store a primary model that will be used to fulfill metric requests from all interfaces i.e. API requests from the CLI or requests from the Transform UI. Your primary model is built from the configs you have in your Transform repo and gets built when a PR is merged via our CI/CD with GitHub actions. You can view the current primary model id by running the following query in the API explorer:

query {
myOrganization {
currentModel {
id
}
}
}

How do I test changes to my model locally?

Changes to your YAML configs will be not be reflected in your production model until you merge them to your transform repo and deploy changes via GitHub actions. To test local changes in your configs, you can add the --config-dir <path-to-transform-directory> option to your query request. This will tell Transform to build your model based on your local configs.

mql query --metrics example_metric --dimensions metric_time --config-dir model --limit 10
    ✔ 🌱 Successfully parsed local configs
✔ Query initialized: 240_1665009454924_0000001
✔ Success 🦄 - query completed after 6.03 seconds
| metric_time | example_metric |
|:--------------------------|-----------------:|
| 2022-03-01 00:00:00+00:00 | 100 |
| 2022-03-02 00:00:00+00:00 | 307 |
| 2022-03-03 00:00:00+00:00 | 2313 |
| 2022-03-04 00:00:00+00:00 | 839 |
| 2022-03-05 00:00:00+00:00 | 770 |
| 2022-03-06 00:00:00+00:00 | 958 |
| 2022-03-07 00:00:00+00:00 | 3272 |
| 2022-03-08 00:00:00+00:00 | 138 |
| 2022-03-09 00:00:00+00:00 | 588 |
| 2022-03-10 00:00:00+00:00 | 456 |

If you want every local API request to use your local configs, you can "pin" your model. Pinning a model means the Transform server will use this model by default for your user. It does not effect other users querying in the UI or from another interface. To do this run mql commit-configs and select y when asked if you would like to pin your model.