Skip to content

Commit

Permalink
Move NodeRelation to dbt/artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
QMalcolm committed Jan 29, 2024
1 parent e7ee80d commit 44405cf
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 14 deletions.
1 change: 1 addition & 0 deletions core/dbt/artifacts/resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,6 @@
Entity,
Measure,
MeasureAggregationParameters,
NodeRelation,
NonAdditiveDimension,
)
8 changes: 8 additions & 0 deletions core/dbt/artifacts/resources/v1/semantic_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ class Defaults(dbtClassMixin):
agg_time_dimension: Optional[str] = None


@dataclass
class NodeRelation(dbtClassMixin):
alias: str
schema_name: str # TODO: Could this be called simply "schema" so we could reuse StateRelation?
database: Optional[str] = None
relation_name: Optional[str] = None


# ====================================
# Dimension objects
# ====================================
Expand Down
11 changes: 2 additions & 9 deletions core/dbt/contracts/graph/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
Measure as MeasureResource,
Documentation as DocumentationResource,
Macro as MacroResource,
NodeRelation as NodeRelationResource,
NodeVersion,
Group as GroupResource,
GraphResource,
Expand Down Expand Up @@ -1623,18 +1624,10 @@ class Group(GroupResource, BaseNode):
# ====================================


@dataclass
class NodeRelation(dbtClassMixin):
alias: str
schema_name: str # TODO: Could this be called simply "schema" so we could reuse StateRelation?
database: Optional[str] = None
relation_name: Optional[str] = None


@dataclass
class SemanticModel(GraphNode):
model: str
node_relation: Optional[NodeRelation]
node_relation: Optional[NodeRelationResource]
description: Optional[str] = None
label: Optional[str] = None
defaults: Optional[DefaultsResource] = None
Expand Down
3 changes: 1 addition & 2 deletions core/dbt/parser/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,8 @@
ManifestNode,
ResultNode,
ModelNode,
NodeRelation,
)
from dbt.artifacts.resources import NodeVersion
from dbt.artifacts.resources import NodeRelation, NodeVersion
from dbt.artifacts.schemas.base import Writable
from dbt.exceptions import (
TargetNotFoundError,
Expand Down
3 changes: 1 addition & 2 deletions tests/unit/test_graph_selector_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
MetricTypeParams,
MetricInputMeasure,
Group,
NodeRelation,
SavedQuery,
SeedNode,
SemanticModel,
Expand All @@ -31,7 +30,7 @@
UnitTestDefinition,
)
from dbt.contracts.graph.manifest import Manifest, ManifestMetadata
from dbt.artifacts.resources import QueryParams
from dbt.artifacts.resources import NodeRelation, QueryParams
from dbt.contracts.graph.unparsed import (
ExposureType,
Owner,
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_semantic_layer_nodes_satisfy_protocols.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
MetricInputMeasure,
MetricTimeWindow,
MetricTypeParams,
NodeRelation,
SavedQuery,
SemanticModel,
)
Expand All @@ -22,6 +21,7 @@
FileSlice,
Measure,
MeasureAggregationParameters,
NodeRelation,
NonAdditiveDimension,
SourceFileMetadata,
WhereFilter,
Expand Down

0 comments on commit 44405cf

Please sign in to comment.