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 {

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
    /opt/hostedtoolcache/Python/3.9.16/x64/lib/python3.9/site-packages/fuzzywuzzy/ UserWarning: Using slow pure-python SequenceMatcher. Install python-Levenshtein to remove this warning
warnings.warn('Using slow pure-python SequenceMatcher. Install python-Levenshtein to remove this warning')
✔ 🌱 Successfully parsed local configs
✔ Query initialized: 203213
✔ Success 🦄 - query completed after 10.18 seconds
| metric_time | example_metric |
| 2022-03-01 00:00:00 | 48 |
| 2022-03-02 00:00:00 | 233 |
| 2022-03-03 00:00:00 | 2092 |
| 2022-03-04 00:00:00 | 973 |
| 2022-03-05 00:00:00 | 938 |
| 2022-03-06 00:00:00 | 856 |
| 2022-03-07 00:00:00 | 3237 |
| 2022-03-08 00:00:00 | 368 |
| 2022-03-09 00:00:00 | 431 |
| 2022-03-10 00:00:00 | 664 |

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.