Skip to content

[Feature] Update spec to include custom_granularities #338

@Jstein77

Description

@Jstein77

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 change to existing dbt-semantic-interfaces functionality, rather than a Big Idea better suited to a discussion

Describe the feature

Its currently possible to add a time_spine configuration to a model configuration in order to make this model available to Metricflow to use in time based joins.

We want to extend this spec to allow users to define custom granularities that a present in the time spine model, like fiscal quarter or 4-5-4 retail months. These custom granularities will then be accesible for Metrciflows built in time operations, like offsets, windows and dynamic granularity calculations.

The proposed spec for adding a custom granularity is below:

models:
	 - name: daily_time_spine
	   description: "a daily time spine with custom granularities"
	   columns:
	     - name: date_day
	       granularity: day
             - name: quarter
	     - name: fortnight
	       description: "the fortnight marker the day belongs to"
	     - name: retail_month
	       description: "the retail month marker the day belongs to"
	   time_spine:
              standard_granularity_column: date_day
	      custom_granularity_columns: #[NEW] A list of columns strucs to use as custom granularities
              - name: fortnight #[NEW] References a custom granularity column defined in the models `columns`
              - name: retail_month
              - name: fiscal_quarter 
                column_name: quarter #[NEW] If the column name is diffrent then the granularity name you want to expose in metricflow, we allow aliasing by referencing the column name here, and the name to expose in metricflow via name.
                  ```

### Describe alternatives you've considered

Use a semantic model.

### Who will this benefit?

_No response_

### Are you interested in contributing this feature?

_No response_

### Anything else?

_No response_

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions