Skip to content

Commit

Permalink
Update docs to include --display-plans.
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Yang committed Apr 13, 2022
1 parent 8c0585b commit 04bee55
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 20 deletions.
29 changes: 19 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ If you do not have postgres on your machine, first install Postgres:
- Postgres provides [pre-built packages for download and installation](https://www.postgresql.org/download/)
- Mac users might prefer to use Homebrew: `brew install postgresql`

If you would like to visualize metric dataflow plans via CLI, install Graphviz:
- Graphviz provides [pre-built packages for download and installation](https://www.graphviz.org/download/)
- Mac users might prefer to use Homebrew: `brew install graphviz`


Then, proceed with the regular installation as follows:

MetricFlow can be installed from PyPi for use as a Python library with the following command:
Expand Down Expand Up @@ -61,16 +66,20 @@ For reference, the tutorial steps are below:
```
🤓 Please run the following steps,
1. In '{$HOME}/.metricflow/config.yml', `model_path` should be '{$HOME}/.metricflow/sample_models'.
2. Try validating your data model: `mf validate-configs`
3. Check out your metrics: `mf list-metrics`
4. Query your first metric: `mf query --metrics transactions --dimensions ds --order ds`
5. Show the SQL MetricFlow generates: `mf query --metrics transactions --dimensions ds --order ds --explain`
6. Add another dimension: `mf query --metrics transactions --dimensions ds,customer__country --order ds`
7. Add a higher date granularity: `mf query --metrics transactions --dimensions ds__week --order ds__week`
8. Try a more complicated query: `mf query --metrics transactions,transaction_usd_na,transaction_usd_na_l7d --dimensions ds,is_large --order ds --where "ds between '2022-03-20' and '2022-04-01'"`
9. For more ways to interact with the sample models, go to ‘https://docs.transform.co/docs/metricflow/metricflow-tutorial’.
10. Once you’re done, run `mf tutorial --skip-dw --drop-tables` to drop the sample tables.
1. In '{$HOME}/.metricflow/config.yml', `model_path` should be '{$HOME}/.metricflow/sample_models'.
2. Try validating your data model: `mf validate-configs`
3. Check out your metrics: `mf list-metrics`
4. Check out dimensions for your metric `mf list-dimensions --metric-names transactions`
5. Query your first metric: `mf query --metrics transactions --dimensions ds --order ds`
6. Show the SQL MetricFlow generates: `mf query --metrics transactions --dimensions ds --order ds --explain`
7. Visualize the plan: `mf query --metrics transactions --dimensions ds --order ds --explain -- display-plans`
* This only works if you have graphviz installed - see README.
* Aesthetic improvements to the visualization are TBD.
8. Add another dimension: `mf query --metrics transactions --dimensions ds,customer__country --order ds`
9. Add a higher date granularity: `mf query --metrics transactions --dimensions ds__week --order ds__week`
10. Try a more complicated query: `mf query --metrics transactions,transaction_usd_na,transaction_usd_na_l7d --dimensions ds,is_large --order ds --start-time 2022-03-20 --end-time 2022-04-01`
11. For more ways to interact with the sample models, go to ‘https://docs.transform.co/docs/metricflow/metricflow-tutorial’.
12. Once you’re done, run `mf tutorial --skip-dw --drop-tables` to drop the sample tables.
```


Expand Down
24 changes: 14 additions & 10 deletions metricflow/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,16 +133,20 @@ def tutorial(ctx: click.core.Context, cfg: CLIContext, msg: bool, skip_dw: bool,
"""\
🤓 Please run the following steps,
1. In '{$HOME}/.metricflow/config.yml', `model_path` should be '{$HOME}/.metricflow/sample_models'.
2. Try validating your data model: `mf validate-configs`
3. Check out your metrics: `mf list-metrics`
4. Query your first metric: `mf query --metrics transactions --dimensions ds --order ds`
5. Show the SQL MetricFlow generates: `mf query --metrics transactions --dimensions ds --order ds --explain`
6. Add another dimension: `mf query --metrics transactions --dimensions ds,customer__country --order ds`
7. Add a higher date granularity: `mf query --metrics transactions --dimensions ds__week --order ds__week`
8. Try a more complicated query: `mf query --metrics transactions,transaction_usd_na,transaction_usd_na_l7d --dimensions ds,is_large --order ds --start-time 2022-03-20 --end-time 2022-04-01`
9. For more ways to interact with the sample models, go to ‘https://docs.transform.co/docs/metricflow/metricflow-tutorial’.
10. Once you’re done, run `mf tutorial --skip-dw --drop-tables` to drop the sample tables.
1. In '{$HOME}/.metricflow/config.yml', `model_path` should be '{$HOME}/.metricflow/sample_models'.
2. Try validating your data model: `mf validate-configs`
3. Check out your metrics: `mf list-metrics`
4. Check out dimensions for your metric `mf list-dimensions --metric-names transactions`
5. Query your first metric: `mf query --metrics transactions --dimensions ds --order ds`
6. Show the SQL MetricFlow generates: `mf query --metrics transactions --dimensions ds --order ds --explain`
7. Visualize the plan: `mf query --metrics transactions --dimensions ds --order ds --explain -- display-plans`
* This only works if you have graphviz installed - see README.
* Aesthetic improvements to the visualization are TBD.
8. Add another dimension: `mf query --metrics transactions --dimensions ds,customer__country --order ds`
9. Add a higher date granularity: `mf query --metrics transactions --dimensions ds__week --order ds__week`
10. Try a more complicated query: `mf query --metrics transactions,transaction_usd_na,transaction_usd_na_l7d --dimensions ds,is_large --order ds --start-time 2022-03-20 --end-time 2022-04-01`
11. For more ways to interact with the sample models, go to ‘https://docs.transform.co/docs/metricflow/metricflow-tutorial’.
12. Once you’re done, run `mf tutorial --skip-dw --drop-tables` to drop the sample tables.
"""
)

Expand Down

0 comments on commit 04bee55

Please sign in to comment.