From 058ee5927e6d0098388995132afdb84028a4df2e Mon Sep 17 00:00:00 2001 From: Doug Beatty <44704949+dbeatty10@users.noreply.github.com> Date: Fri, 8 Mar 2024 18:37:04 -0500 Subject: [PATCH 1/6] Update example for overriding the `ref` macro --- website/docs/reference/dbt-jinja-functions/builtins.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/website/docs/reference/dbt-jinja-functions/builtins.md b/website/docs/reference/dbt-jinja-functions/builtins.md index 7d970b9d5e1..f4bf2e5fc20 100644 --- a/website/docs/reference/dbt-jinja-functions/builtins.md +++ b/website/docs/reference/dbt-jinja-functions/builtins.md @@ -22,8 +22,10 @@ Using the `builtins` variable in this way is an advanced development workflow. U ::: - -From dbt v1.5 and higher, use the following macro to extract user-provided arguments, including version, and call the builtins.ref() function with either a single modelname argument or both packagename and modelname arguments, based on the number of positional arguments in varargs: + +From dbt v1.5 and higher, use the following macro to override the `ref` method available in the model compilation context to return a [Relation](/reference/dbt-classes#relation) with the database name overriden to `dev`. + +It includes logic to extract user-provided arguments, including version, and call the builtins.ref() function with either a single modelname argument or both packagename and modelname arguments, based on the number of positional arguments in varargs.

From 75b277019a46722b510d8e83f5f6231c8cefde7c Mon Sep 17 00:00:00 2001 From: Doug Beatty <44704949+dbeatty10@users.noreply.github.com> Date: Fri, 8 Mar 2024 18:45:30 -0500 Subject: [PATCH 2/6] Update indentation --- website/docs/reference/dbt-jinja-functions/builtins.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/website/docs/reference/dbt-jinja-functions/builtins.md b/website/docs/reference/dbt-jinja-functions/builtins.md index f4bf2e5fc20..243558b9a98 100644 --- a/website/docs/reference/dbt-jinja-functions/builtins.md +++ b/website/docs/reference/dbt-jinja-functions/builtins.md @@ -31,16 +31,16 @@ It includes logic to extract user-provided arguments, including version Date: Fri, 8 Mar 2024 18:46:55 -0500 Subject: [PATCH 3/6] Restore macro name --- website/docs/reference/dbt-jinja-functions/builtins.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/website/docs/reference/dbt-jinja-functions/builtins.md b/website/docs/reference/dbt-jinja-functions/builtins.md index 243558b9a98..246ea1b7af7 100644 --- a/website/docs/reference/dbt-jinja-functions/builtins.md +++ b/website/docs/reference/dbt-jinja-functions/builtins.md @@ -31,6 +31,8 @@ It includes logic to extract user-provided arguments, including version Date: Fri, 8 Mar 2024 18:47:42 -0500 Subject: [PATCH 4/6] Handle `v` keyword argument for model versions --- website/docs/reference/dbt-jinja-functions/builtins.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/reference/dbt-jinja-functions/builtins.md b/website/docs/reference/dbt-jinja-functions/builtins.md index 246ea1b7af7..2f96e16bd3d 100644 --- a/website/docs/reference/dbt-jinja-functions/builtins.md +++ b/website/docs/reference/dbt-jinja-functions/builtins.md @@ -34,7 +34,7 @@ It includes logic to extract user-provided arguments, including version Date: Fri, 8 Mar 2024 18:53:27 -0500 Subject: [PATCH 5/6] Make the second example work both pre- and post- v1.5 --- website/docs/reference/dbt-jinja-functions/builtins.md | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/website/docs/reference/dbt-jinja-functions/builtins.md b/website/docs/reference/dbt-jinja-functions/builtins.md index 2f96e16bd3d..9f1d139ab20 100644 --- a/website/docs/reference/dbt-jinja-functions/builtins.md +++ b/website/docs/reference/dbt-jinja-functions/builtins.md @@ -75,14 +75,10 @@ From dbt v1.4 and lower, use the following macro to override the `ref` method av ```
-The ref macro can also be used to control which elements of the model path are rendered when run, for example the following macro overrides the `ref` method to render only the schema and object identifier, but not the database reference i.e. `my_schema.my_model` rather than `my_database.my_schema.my_model`. This is especially useful when using snowflake as a warehouse, if you intend to change the name of the database post-build and wish the references to remain accurate. +Logic within the ref macro can also be used to control which elements of the model path are rendered when run, for example the following logic renders only the schema and object identifier, but not the database reference i.e. `my_schema.my_model` rather than `my_database.my_schema.my_model`. This is especially useful when using snowflake as a warehouse, if you intend to change the name of the database post-build and wish the references to remain accurate. ``` --- Macro to override ref and to render identifiers without a database. -{% macro ref(model_name) %} - - {% do return(builtins.ref(model_name).include(database=false)) %} - -{% endmacro %} + -- render identifiers without a database + {% do return(rel.include(database=false)) %} ``` From ed1b819decc4e826c4e9c2a3c79c3b27ad86ab29 Mon Sep 17 00:00:00 2001 From: Mirna Wong <89008547+mirnawong1@users.noreply.github.com> Date: Mon, 11 Mar 2024 17:12:02 +0000 Subject: [PATCH 6/6] remove cloud cli support for --start/--end-time this pr removes the support for `--start-time` and `--end-time` flags per [slack thread](https://getdbt.slack.com/archives/C046L0VTVR6/p1709678828790809) discovery --- website/docs/docs/build/metricflow-commands.md | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/website/docs/docs/build/metricflow-commands.md b/website/docs/docs/build/metricflow-commands.md index 4693aa1a774..af5a54819c0 100644 --- a/website/docs/docs/build/metricflow-commands.md +++ b/website/docs/docs/build/metricflow-commands.md @@ -156,8 +156,10 @@ Options: [required] --end-time TEXT Optional iso8601 timestamp to constraint the end time of the data (inclusive) + *Not available in dbt Cloud yet --start-time TEXT Optional iso8601 timestamp to constraint the start time of the data (inclusive) + *Not available in dbt Cloud yet --help Show this message and exit. ``` @@ -268,10 +270,12 @@ Options: ds, org. --end-time TEXT Optional iso8601 timestamp to constraint the end - time of the data (inclusive) + time of the data (inclusive). + *Not available in dbt Cloud yet --start-time TEXT Optional iso8601 timestamp to constraint the start time of the data (inclusive) + *Not available in dbt Cloud yet --where TEXT SQL-like where statement provided as a string. For example: --where "revenue > 100". To add a dimension filter to @@ -306,7 +310,7 @@ Options: ### Query examples -The following tabs present various different types of query examples that you can use to query metrics and dimensions. Select the tab that best suits your needs: +The following tabs present various types of query examples that you can use to query metrics and dimensions. Select the tab that best suits your needs: @@ -428,11 +432,14 @@ mf query --metrics order_total --group-by metric_time --where "{{ Dimension('ord To filter by time, there are dedicated start and end time options. Using these options to filter by time allows MetricFlow to further optimize query performance by pushing down the where filter when appropriate. -**Query** -```bash + + +**Query** +```bash # In dbt Core mf query --metrics order_total --group-by metric_time,is_food_order --limit 10 --order -metric_time --where "is_food_order = True" --start-time '2017-08-22' --end-time '2017-08-27' ```