diff --git a/dbt_semantic_interfaces/transformations/default_grain.py b/dbt_semantic_interfaces/transformations/default_granularity.py similarity index 95% rename from dbt_semantic_interfaces/transformations/default_grain.py rename to dbt_semantic_interfaces/transformations/default_granularity.py index 0b31a8f0..6e5f9af6 100644 --- a/dbt_semantic_interfaces/transformations/default_grain.py +++ b/dbt_semantic_interfaces/transformations/default_granularity.py @@ -16,7 +16,7 @@ from dbt_semantic_interfaces.type_enums.time_granularity import TimeGranularity -class SetDefaultGrainRule(ProtocolHint[SemanticManifestTransformRule[PydanticSemanticManifest]]): +class SetDefaultGranularityRule(ProtocolHint[SemanticManifestTransformRule[PydanticSemanticManifest]]): """If default_granularity is not set for a metric, set it to DAY if available, else the smallest available grain.""" @override diff --git a/dbt_semantic_interfaces/validations/metrics.py b/dbt_semantic_interfaces/validations/metrics.py index bced1a64..4e68afaa 100644 --- a/dbt_semantic_interfaces/validations/metrics.py +++ b/dbt_semantic_interfaces/validations/metrics.py @@ -577,7 +577,7 @@ def validate_manifest(semantic_manifest: SemanticManifestT) -> Sequence[Validati return issues -class DefaultGrainRule(SemanticManifestValidationRule[SemanticManifestT], Generic[SemanticManifestT]): +class DefaultGranularityRule(SemanticManifestValidationRule[SemanticManifestT], Generic[SemanticManifestT]): """Checks that default_granularity set for metric is queryable for that metric.""" @staticmethod @@ -619,7 +619,7 @@ def _validate_metric( ) if metric.default_granularity: - min_queryable_granularity = DefaultGrainRule._min_queryable_granularity_for_metric( + min_queryable_granularity = DefaultGranularityRule._min_queryable_granularity_for_metric( metric=metric, metric_index=metric_index, measure_to_agg_time_dimension=measure_to_agg_time_dimension ) valid_granularities = [ @@ -666,7 +666,7 @@ def validate_manifest(semantic_manifest: SemanticManifestT) -> Sequence[Validati metric_index = {MetricReference(metric.name): metric for metric in semantic_manifest.metrics} for metric in semantic_manifest.metrics or []: - issues += DefaultGrainRule._validate_metric( + issues += DefaultGranularityRule._validate_metric( metric=metric, metric_index=metric_index, measure_to_agg_time_dimension=measure_to_agg_time_dimension, diff --git a/pyproject.toml b/pyproject.toml index 60bb3415..30394519 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "dbt-semantic-interfaces" -version = "0.6.2.dev0" +version = "0.6.2.dev1" description = 'The shared semantic layer definitions that dbt-core and MetricFlow use' readme = "README.md" requires-python = ">=3.8" diff --git a/tests/validations/test_metrics.py b/tests/validations/test_metrics.py index a84cbe6a..b6b25f7f 100644 --- a/tests/validations/test_metrics.py +++ b/tests/validations/test_metrics.py @@ -46,7 +46,7 @@ CUMULATIVE_TYPE_PARAMS_SUPPORTED, ConversionMetricRule, CumulativeMetricRule, - DefaultGrainRule, + DefaultGranularityRule, DerivedMetricRule, WhereFiltersAreParseable, ) @@ -722,7 +722,7 @@ def test_default_granularity() -> None: month_measure_name = "boo" week_time_dim_name = "ds__week" month_time_dim_name = "ds__month" - model_validator = SemanticManifestValidator[PydanticSemanticManifest]([DefaultGrainRule()]) + model_validator = SemanticManifestValidator[PydanticSemanticManifest]([DefaultGranularityRule()]) validation_results = model_validator.validate_semantic_manifest( PydanticSemanticManifest( semantic_models=[