Skip to content

Commit

Permalink
add new command
Browse files Browse the repository at this point in the history
  • Loading branch information
mirnawong1 committed Jul 29, 2024
1 parent 0165316 commit 59c2b30
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 2 deletions.
25 changes: 24 additions & 1 deletion 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 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.
- [`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 @@ -580,6 +583,26 @@ 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
```
### Exports
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.
```bash
dbt sl export # In dbt Cloud
mf export # In dbt Core
```
### 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.
```bash
dbt sl export-all # In dbt Cloud
mf export-all # In dbt Core
```
## 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

You can 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 to 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

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

#### Output
```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

0 comments on commit 59c2b30

Please sign in to comment.