dbt-labs / dbt-labs/metricflow

[SL-1757] [Feature] Specify a partition key for exports

Open
#1,041 0 comments 1 reaction 0 assignees View on GitHub
enhancement triage
Dominant language
Python
Stars
1.8k
Forks
202
Avg merge
1d 8h
Merged PRs (30d)
14

Description

### Is this your first time submitting a feature request?

- [X] I have read the [expectations for open source contributors](https://docs.getdbt.com/docs/contributing/oss-expectations)
- [X] I have searched the existing issues, and I could not find an existing issue for this feature
- [X] I am requesting a straightforward extension of existing metricflow functionality, rather than a Big Idea better suited to a discussion

### Describe the feature

There is currently no way to add a partition key when creating an export. We support this functionality for [creating dbt models](https://docs.getdbt.com/reference/resource-configs/bigquery-configs#partition-clause). This is especially important for BigQuery users as querying a table without a partition can be prohibitively expensive.

When creating an export I should be able to pass in the following fields
```
{
"field": "",
"data_type": "",
"granularity": ""

# Only required if data_type is "int64"
"range": {
"start": ,
"end": ,
"interval":
}
}
```
This will update how we render the DDL, and add a partition to the resulting table.

For example i could define an export as follows:
```yaml
exports:
- name: my_export
configs:
export_as: table
partition_by:
field: parition_column
data_type: timestamp
granularity: day
```

This would render the following DDL:
```sql
create table `projectname`.`analytics`.`bigquery_table` (...)
partition by timestamp_trunc(parition_column, day);

```

### Describe alternatives you've considered

_No response_

### Who will this benefit?

_No response_

### Are you interested in contributing this feature?

_No response_

### Anything else?

_No response_

[SL-1757](https://linear.app/dbt-labs/issue/SL-1757/[feature]-specify-a-partition-key-for-exports)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.