Skip to content

Commit

Permalink
Merge branch 'main' into mashumaro_fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
gshank committed Dec 10, 2024
2 parents 1a30f64 + fc6167a commit c137041
Show file tree
Hide file tree
Showing 48 changed files with 1,293 additions and 650 deletions.
6 changes: 6 additions & 0 deletions .changes/unreleased/Dependencies-20241112-163815.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: Dependencies
body: Upgrading dbt-semantic-interfaces to 0.8.3 for custom grain support in offset windows
time: 2024-11-12T16:38:15.351519-05:00
custom:
Author: WilliamDee
Issue: None
6 changes: 6 additions & 0 deletions .changes/unreleased/Features-20241121-125630.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: Features
body: Add `batch` context object to model jinja context
time: 2024-11-21T12:56:30.715473-06:00
custom:
Author: QMalcolm
Issue: "11025"
7 changes: 7 additions & 0 deletions .changes/unreleased/Features-20241206-195308.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
kind: Features
body: Ensure pre/post hooks only run on first/last batch respectively for microbatch
model batches
time: 2024-12-06T19:53:08.928793-06:00
custom:
Author: MichelleArk QMalcolm
Issue: 11094 11104
6 changes: 6 additions & 0 deletions .changes/unreleased/Fixes-20240822-122132.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: Fixes
body: dbt retry does not respect --threads
time: 2024-08-22T12:21:32.358066+05:30
custom:
Author: donjin-master
Issue: "10584"
6 changes: 6 additions & 0 deletions .changes/unreleased/Fixes-20241128-162936.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: Fixes
body: Access DBUG flag more consistently with the rest of the codebase in ManifestLoader
time: 2024-11-28T16:29:36.236729+01:00
custom:
Author: Threynaud
Issue: "11068"
6 changes: 6 additions & 0 deletions .changes/unreleased/Fixes-20241204-100429.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: Fixes
body: Improve the performance characteristics of add_test_edges()
time: 2024-12-04T10:04:29.096231-05:00
custom:
Author: peterallenwebb
Issue: "10950"
6 changes: 6 additions & 0 deletions .changes/unreleased/Fixes-20241205-145307.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: Fixes
body: Implement partial parsing for singular data test configs in yaml files
time: 2024-12-05T14:53:07.295536-05:00
custom:
Author: gshank
Issue: "10801"
6 changes: 6 additions & 0 deletions .changes/unreleased/Fixes-20241209-113806.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: Fixes
body: Fix debug log messages for microbatch batch execution information
time: 2024-12-09T11:38:06.972743-06:00
custom:
Author: MichelleArk QMalcolm
Issue: "11111"
6 changes: 6 additions & 0 deletions .changes/unreleased/Fixes-20241209-133317.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: Fixes
body: Fix running of extra "last" batch when there is only one batch
time: 2024-12-09T13:33:17.253326-06:00
custom:
Author: QMalcolm
Issue: "11112"
6 changes: 6 additions & 0 deletions .changes/unreleased/Fixes-20241209-150711.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: Fixes
body: Fix interpretation of `PartialSuccess` to result in non-zero exit code
time: 2024-12-09T15:07:11.391313-06:00
custom:
Author: QMalcolm
Issue: "11114"
7 changes: 7 additions & 0 deletions .changes/unreleased/Under the Hood-20241205-143144.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
kind: Under the Hood
body: Improve selection peformance by optimizing the select_children() and select_parents()
functions.
time: 2024-12-05T14:31:44.584216-05:00
custom:
Author: peterallenwebb
Issue: "11099"
20 changes: 15 additions & 5 deletions core/dbt/artifacts/resources/v1/metric.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,15 @@ def post_aggregation_measure_reference(self) -> MeasureReference:
@dataclass
class MetricTimeWindow(dbtClassMixin):
count: int
granularity: TimeGranularity
granularity: str

@property
def window_string(self) -> str: # noqa: D
return f"{self.count} {self.granularity}"

@property
def is_standard_granularity(self) -> bool: # noqa: D
return self.granularity.casefold() in {item.value.casefold() for item in TimeGranularity}


@dataclass
Expand All @@ -55,7 +63,7 @@ class MetricInput(dbtClassMixin):
filter: Optional[WhereFilterIntersection] = None
alias: Optional[str] = None
offset_window: Optional[MetricTimeWindow] = None
offset_to_grain: Optional[TimeGranularity] = None
offset_to_grain: Optional[str] = None

def as_reference(self) -> MetricReference:
return MetricReference(element_name=self.name)
Expand Down Expand Up @@ -83,7 +91,7 @@ class ConversionTypeParams(dbtClassMixin):
@dataclass
class CumulativeTypeParams(dbtClassMixin):
window: Optional[MetricTimeWindow] = None
grain_to_date: Optional[TimeGranularity] = None
grain_to_date: Optional[str] = None
period_agg: PeriodAggregation = PeriodAggregation.FIRST


Expand All @@ -95,7 +103,9 @@ class MetricTypeParams(dbtClassMixin):
denominator: Optional[MetricInput] = None
expr: Optional[str] = None
window: Optional[MetricTimeWindow] = None
grain_to_date: Optional[TimeGranularity] = None
grain_to_date: Optional[TimeGranularity] = (
None # legacy, use cumulative_type_params.grain_to_date
)
metrics: Optional[List[MetricInput]] = None
conversion_type_params: Optional[ConversionTypeParams] = None
cumulative_type_params: Optional[CumulativeTypeParams] = None
Expand All @@ -121,7 +131,7 @@ class Metric(GraphResource):
type_params: MetricTypeParams
filter: Optional[WhereFilterIntersection] = None
metadata: Optional[SourceFileMetadata] = None
time_granularity: Optional[TimeGranularity] = None
time_granularity: Optional[str] = None
resource_type: Literal[NodeType.Metric]
meta: Dict[str, Any] = field(default_factory=dict, metadata=MergeBehavior.Update.meta())
tags: List[str] = field(default_factory=list)
Expand Down
14 changes: 9 additions & 5 deletions core/dbt/artifacts/resources/v1/semantic_layer_components.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,21 @@
class WhereFilter(dbtClassMixin):
where_sql_template: str

@property
def call_parameter_sets(self) -> FilterCallParameterSets:
return WhereFilterParser.parse_call_parameter_sets(self.where_sql_template)
def call_parameter_sets(
self, custom_granularity_names: Sequence[str]
) -> FilterCallParameterSets:
return WhereFilterParser.parse_call_parameter_sets(
self.where_sql_template, custom_granularity_names=custom_granularity_names
)


@dataclass
class WhereFilterIntersection(dbtClassMixin):
where_filters: List[WhereFilter]

@property
def filter_expression_parameter_sets(self) -> Sequence[Tuple[str, FilterCallParameterSets]]:
def filter_expression_parameter_sets(
self, custom_granularity_names: Sequence[str]
) -> Sequence[Tuple[str, FilterCallParameterSets]]:
raise NotImplementedError


Expand Down
11 changes: 11 additions & 0 deletions core/dbt/artifacts/resources/v1/semantic_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@
"""


@dataclass
class SemanticLayerElementConfig(dbtClassMixin):
meta: Dict[str, Any] = field(
default_factory=dict,
metadata=MergeBehavior.Update.meta(),
)


@dataclass
class Defaults(dbtClassMixin):
agg_time_dimension: Optional[str] = None
Expand Down Expand Up @@ -72,6 +80,7 @@ class Dimension(dbtClassMixin):
type_params: Optional[DimensionTypeParams] = None
expr: Optional[str] = None
metadata: Optional[SourceFileMetadata] = None
config: Optional[SemanticLayerElementConfig] = None

@property
def reference(self) -> DimensionReference:
Expand Down Expand Up @@ -106,6 +115,7 @@ class Entity(dbtClassMixin):
label: Optional[str] = None
role: Optional[str] = None
expr: Optional[str] = None
config: Optional[SemanticLayerElementConfig] = None

@property
def reference(self) -> EntityReference:
Expand Down Expand Up @@ -147,6 +157,7 @@ class Measure(dbtClassMixin):
agg_params: Optional[MeasureAggregationParameters] = None
non_additive_dimension: Optional[NonAdditiveDimension] = None
agg_time_dimension: Optional[str] = None
config: Optional[SemanticLayerElementConfig] = None

@property
def reference(self) -> MeasureReference:
Expand Down
1 change: 1 addition & 0 deletions core/dbt/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ def global_flags(func):
@p.warn_error
@p.warn_error_options
@p.write_json
@p.use_fast_test_edges
@functools.wraps(func)
def wrapper(*args, **kwargs):
return func(*args, **kwargs)
Expand Down
7 changes: 7 additions & 0 deletions core/dbt/cli/params.py
Original file line number Diff line number Diff line change
Expand Up @@ -735,3 +735,10 @@ def _version_callback(ctx, _param, value):
envvar="DBT_SHOW_RESOURCE_REPORT",
hidden=True,
)

use_fast_test_edges = click.option(
"--use-fast-test-edges/--no-use-fast-test-edges",
envvar="DBT_USE_FAST_TEST_EDGES",
default=False,
hidden=True,
)
Loading

0 comments on commit c137041

Please sign in to comment.