Skip to content

Commit adcce4a

Browse files
Add parsed_column_name property to PydanticTimeSpineCustomGranularityColumn (#349)
This allows us to centralize this logic in one place to use everywhere instead of rewriting it in different places. ### Checklist - [ ] I have read [the contributing guide](https://github.com/dbt-labs/dbt-semantic-interfaces/blob/main/CONTRIBUTING.md) and understand what's expected of me - [ ] I have signed the [CLA](https://docs.getdbt.com/docs/contributor-license-agreements) - [ ] This PR includes tests, or tests are not required/relevant for this PR - [ ] I have run `changie new` to [create a changelog entry](https://github.com/dbt-labs/dbt-semantic-interfaces/blob/main/CONTRIBUTING.md#adding-a-changelog-entry)
1 parent ff37d9f commit adcce4a

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

dbt_semantic_interfaces/implementations/time_spine.py

+9
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,15 @@ def _implements_protocol(self) -> TimeSpineCustomGranularityColumn:
3535
name: str
3636
column_name: Optional[str] = None
3737

38+
@property
39+
def parsed_column_name(self) -> str:
40+
"""The name of the column in the time spine table that contains this custom granularity.
41+
42+
For convenience in writing configs, if there is no `column_name` set, we assume the `name`
43+
is also the column name.
44+
"""
45+
return self.column_name or self.name
46+
3847

3948
class PydanticTimeSpine(HashableBaseModel, ProtocolHint[TimeSpine]): # noqa: D101
4049
@override

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "dbt-semantic-interfaces"
3-
version = "0.7.1"
3+
version = "0.7.2.dev0"
44
description = 'The shared semantic layer definitions that dbt-core and MetricFlow use'
55
readme = "README.md"
66
requires-python = ">=3.8"

0 commit comments

Comments
 (0)