Skip to content

Commit

Permalink
Remove unnecessary deepcopy call (#1345)
Browse files Browse the repository at this point in the history
This PR removes a `deepcopy` call that is used when fetching dimensions.
The call seems unnecessary as the manifest should not be modified during
a query. This call was also found to have a significant impact in
performance during profiling.
  • Loading branch information
plypaul authored Sep 6, 2024
1 parent 27218b2 commit 0ace6d6
Showing 1 changed file with 1 addition and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from __future__ import annotations

import logging
from copy import deepcopy
from typing import Dict, List, Optional, Sequence, Set

from dbt_semantic_interfaces.protocols.dimension import Dimension
Expand Down Expand Up @@ -92,13 +91,11 @@ def get_dimension(self, dimension_reference: DimensionReference) -> Dimension:
f"Could not find dimension with name '{dimension_reference.element_name}' in configured semantic models"
)

dimension = SemanticModelLookup.get_dimension_from_semantic_model(
return SemanticModelLookup.get_dimension_from_semantic_model(
# Dimension object should match across semantic models, so just use the first semantic model.
semantic_model=semantic_models[0],
dimension_reference=dimension_reference,
)
# TODO: Unclear if the deepcopy is necessary.
return deepcopy(dimension)

def get_time_dimension(self, time_dimension_reference: TimeDimensionReference) -> Dimension:
"""Retrieves a full dimension object by name."""
Expand Down

0 comments on commit 0ace6d6

Please sign in to comment.