Skip to main content

Framework Config Development Workflow

Validating Updated Configs#

When locally editing data source and metric config yamls, use the CLI command mql validate-configs to validate changes before pushing those changes and creating a pull request. The changes do not need to be committed, just saved. 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 > Successfully validated model configs for commit (da500aa4f54cbf8f3eb47a1dc2c136715c9197b9-dirty) in repo (metrics), on branch (updating-revenue-dimensions)

Testing Configs in the CLI#

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-dirtyWould you like to pin this this model commit for future MQL queries? [y/N]: ySuccess! 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