Skip to main content

Config Development Workflow

MetricFlow

Config Validation

When locally editing data source and metric config yamls, use the CLI command mf validate-configs to validate changes before pushing those changes and creating a pull request. The changes do not need to be committed, just saved locally. While in the repository directory, call mf validate-configs:

~/git/metrics > mf validate-configs

This will run the validate script and return any known errors or inconstancies. When the command succeeds, you'll see messages similar to the following:

~/git/metrics > mf validate-config
• WARNING: Identifier `transaction` only found in one data source `transactions` which means it will not be used in joins.
• WARNING: Identifier `id_order` only found in one data source `transactions` which means it will not be used in joins.
• WARNING: Identifier `customer_order` only found in one data source `transactions` which means it will not be used in joins.

Testing Configs

In MetricFlow, configs can be tested by running queries. For example you could test new_dimension dimensions using the query below if you have a revenue metric:

~/git/metrics > mf query --metrics revenue --dimensions new_dimension --limit 10

Transform

Config Validation

Similarly, in Transform, you can validate configs using the mql CLI. While in the repository directory, call mql validate-configs and reference the directory with the configs in the --config-dir string. In the example below, the repository is called metrics and the config folder is called configs:

~/git/metrics > mql validate-configs --config-dir configs

This will run the validate script and return any known errors or inconstancies. When the command succeeds, you'll see a messages similar to the following:

~/git/metrics > mql validate-configs --config-dir configs
Successfully validated model configs for commit (da500aa4f54cbf8f3eb47a1dc2c136715c9197b9-dirty) in repo (metrics), on branch (updating-revenue-dimensions)

Testing Configs

The mql commit-configs command allows for testing with the CLI. This command will commit your local changes to the head of your current git branch. The MQL server will always execute queries against the head of the current git branch you specify. After running this command, you can choose to use the updated local configs to run mql query commands by "pinning" your new model.

Navigate to the appropriate directory and run mql commit-configs with an optional reference to the config folder. This will commit the changes so that they can be pinned to use with future mql query commands. In the example below, the repository is called metrics and the config folder is called configs:

~/git/metrics >  mql commit-configs --config-dir configs
✔ 🦄 Successfully committed model id 6874 on branch updating-revenue-dimensions with commit da500aa4f54cbf8f3eb47a1dc2c136715c9197b9-dirty
Would you like to pin this this model commit for future MQL queries? [y/N]: y
Success! You can make future queries against the model id 1234.

After committed, there will be a prompt following the next run mql query request to "pin" to this new model. "Pinning" a model tells mql which metric model to use for mql queries.

~/git/metrics > mql query --metrics revenue --dimensions new_dimension --limit 10
📌 We've found a pinned model ID from a previous request, uploaded at 2021-02-01T02:24:36.067763+00:00, which does not match the primary model for the Demo organization.
Do you want to reuse this model for this request? If not, we will default you to the current model for Slack Demo. [y/N]: y

If you answer y to the prompt, you will leverage the new model configs.

You will be prompted in each mql query until you select n. You will then need to run mql commit-configs again in order to pin to a local model.

A simple shortcut to the above workflow is to point at your local configs in the query. You will not be prompted and instead this will commit those models and point to that model for you then revert to the production configs.

~/git/metrics > mql query --metrics revenue --dimensions new_dimension --limit 10 --config-dir configs