dbt-labs/metricflow

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

Opened this issue · 0 comments

Is this your first time submitting a feature request?

  • I have read the expectations for open source contributors
  • I have searched the existing issues, and I could not find an existing issue for this feature
  • 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. 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": "<field name>",
  "data_type": "<timestamp | date | datetime | int64>",
  "granularity": "<hour | day | month | year>"

  # Only required if data_type is "int64"
  "range": {
    "start": <int>,
    "end": <int>,
    "interval": <int>
  }
}

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:

exports:
  - name: my_export
    configs:
       export_as: table 
       partition_by:
          field: parition_column
          data_type: timestamp
          granularity: day

This would render the following DDL:

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