Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add new command #5855

Merged
merged 16 commits into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 26 additions & 3 deletions website/docs/docs/build/metricflow-commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ MetricFlow provides the following commands to retrieve metadata and query metric
<Tabs>
<TabItem value="cloud" label="Commands for dbt Cloud CLI">

You can use the `dbt sl` prefix before the command name to execute them in the dbt Cloud CLI. For example, to list all metrics, run `dbt sl list metrics`.
You can use the `dbt sl` prefix before the command name to execute them in the dbt Cloud CLI. For example, to list all metrics, run `dbt sl list metrics`. For a complete list of the MetricFlow commands and flags, run the `dbt sl --help` command in your terminal.

- [`list`](#list) &mdash; Retrieves metadata values.
- [`list metrics`](#list-metrics) &mdash; Lists metrics with dimensions.
Expand All @@ -76,6 +76,9 @@ You can use the `dbt sl` prefix before the command name to execute them in the d
- [`list entities`](#list-entities) &mdash; Lists all unique entities.
- [`list saved queries`](#list-saved-queries) &mdash; Lists available saved queries. Use the `--show-exports` flag to display each export listed under a saved query.
- [`query`](#query) &mdash; Query metrics, saved queries, and dimensions you want to see in the command line interface. Refer to [query examples](#query-examples) to help you get started.
- [`export`](#exports) &mdash; Runs exports for a singular saved query for testing and generating exports in your development environment. You can also use the `--select` flag to specify particular exports from a saved query.
mirnawong1 marked this conversation as resolved.
Show resolved Hide resolved
- [`export-all`](#export-all) &mdash; Runs exports for multiple saved queries at once, saving time and effort.


<!--below commands aren't supported in dbt cloud yet
- [`validate-configs`](#validate-configs) &mdash; Validates semantic model configurations.
Expand Down Expand Up @@ -152,7 +155,7 @@ Options:
--help Show this message and exit.
```

## List dimension-values
### List dimension-values

This command lists all dimension values with the corresponding metric:

Expand Down Expand Up @@ -385,7 +388,6 @@ mf query --metrics order_total --group-by metric_time,is_food_order # In dbt Cor

</TabItem>


<TabItem value="eg3" label="Order/limit">

You can add order and limit functions to filter and present the data in a readable format. The following query limits the data set to 10 records and orders them by `metric_time`, descending. Note that using the `-` prefix will sort the query in descending order. Without the `-` prefix sorts the query in ascending order.
Expand Down Expand Up @@ -580,6 +582,27 @@ dbt sl query --metrics revenue --group-by metric_time__month # In dbt Cloud
mf query --metrics revenue --group-by metric_time__month # In dbt Core
```

### Export

Run [exports for a specific saved query](/docs/use-dbt-semantic-layer/exports#exports-for-single-saved-query). Use this command to test and generate exports in your development environment. You can also use the `--select` flag to specify particular exports from a saved query. Refer to [exports in development](/docs/use-dbt-semantic-layer/exports#exports-in-development) for more info.

Exports is available in dbt Cloud.
mirnawong1 marked this conversation as resolved.
Show resolved Hide resolved

```bash
dbt sl export
```

### Export-all

Run [exports for multiple saved queries](/docs/use-dbt-semantic-layer/exports#exports-for-multiple-saved-queries) at once. This command provides a convenient way to manage and execute exports for several queries simultaneously, saving time and effort. Refer to [exports in development](/docs/use-dbt-semantic-layer/exports#exports-in-development) for more info.

Exports is available in dbt Cloud.
mirnawong1 marked this conversation as resolved.
Show resolved Hide resolved

```bash
dbt sl export-all
```


## FAQs

<detailsToggle alt_header="How can I add a dimension filter to a where filter?">
Expand Down
36 changes: 35 additions & 1 deletion website/docs/docs/use-dbt-semantic-layer/exports.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,17 @@ There are two ways to run an export:

## Exports in development

You can run an export in your development environment using your development credentials if you want to test the output of the export before production. You can use the following command to run exports in the dbt Cloud CLI:
You can run an export in your development environment using your development credentials if you want to test the output of the export before production.

This section explains the different commands and options available to run exports in development.

- Use the [`dbt sl export` command](#exports-for-single-saved-query) to test and generate exports in your development environment for a singular saved query. You can also use the `--select` flag to specify particular exports from a saved query.

- Use the [`dbt sl export-all` command](#exports-for-multiple-saved-queries) to run exports for multiple saved queries at once. This command provides a convenient way to manage and execute exports for several queries simultaneously, saving time and effort.

### Exports for single saved query

Use the following command to run exports in the dbt Cloud CLI:

```bash
dbt sl export
Expand Down Expand Up @@ -119,6 +129,30 @@ dbt sl export --saved-query sq_number1 --export-as table --alias new_export
```
</details>

### Exports for multiple saved queries

Use the command, `dbt sl export-all`, to run exports for multiple saved queries at once. This is different from the `dbt sl export` command, which only runs exports for a singular saved query. For example, to run exports for multiple saved queries, you can use:

#### Example
mirnawong1 marked this conversation as resolved.
Show resolved Hide resolved

```bash
dbt sl export-all
```

#### Output
mirnawong1 marked this conversation as resolved.
Show resolved Hide resolved
```bash
Exports completed:
- Created TABLE at `DBT_SL_TEST.new_customer_orders`
- Created VIEW at `DBT_SL_TEST.new_customer_orders_export_alias`
- Created TABLE at `DBT_SL_TEST.order_data_key_metrics`
- Created TABLE at `DBT_SL_TEST.weekly_revenue`

Polling completed
```

The command `dbt sl export-all` provides the flexibility to manage multiple exports in a single command.


## Exports in production

Enabling and executing exports in dbt Cloud optimizes data workflows and ensures real-time data access. It enhances efficiency and governance for smarter decisions.
Expand Down
Loading