-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add "other" relation to reffable node classes #7645
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
kind: Under the Hood | ||
body: Add other relation to reffable nodes | ||
time: 2023-05-15T15:21:07.808892-05:00 | ||
custom: | ||
Author: stu-k | ||
Issue: "7550" |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -271,16 +271,20 @@ def add_public_node(self, value: str): | |
|
||
|
||
@dataclass | ||
class ParsedNodeMandatory(GraphNode, HasRelationMetadata, Replaceable): | ||
class RelationalNode(HasRelationMetadata): | ||
alias: str | ||
checksum: FileHash | ||
config: NodeConfig = field(default_factory=NodeConfig) | ||
|
||
@property | ||
def identifier(self): | ||
return self.alias | ||
|
||
|
||
@dataclass | ||
class ParsedNodeMandatory(GraphNode, RelationalNode, Replaceable): | ||
checksum: FileHash | ||
config: NodeConfig = field(default_factory=NodeConfig) | ||
|
||
|
||
# This needs to be in all ManifestNodes and also in SourceDefinition, | ||
# because of "source freshness" | ||
@dataclass | ||
|
@@ -615,6 +619,7 @@ class ModelNode(CompiledNode): | |
constraints: List[ModelLevelConstraint] = field(default_factory=list) | ||
version: Optional[NodeVersion] = None | ||
latest_version: Optional[NodeVersion] = None | ||
state_relation: Optional[RelationalNode] = None | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As mentioned in the PR description, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Spoke with Gerda about this name and she thought it made sense for the context it was in. |
||
|
||
@property | ||
def is_latest_version(self) -> bool: | ||
|
@@ -797,6 +802,7 @@ class SeedNode(ParsedNode): # No SQLDefaults! | |
# and we need the root_path to load the seed later | ||
root_path: Optional[str] = None | ||
depends_on: MacroDependsOn = field(default_factory=MacroDependsOn) | ||
state_relation: Optional[RelationalNode] = None | ||
|
||
def same_seeds(self, other: "SeedNode") -> bool: | ||
# for seeds, we check the hashes. If the hashes are different types, | ||
|
@@ -995,6 +1001,7 @@ class IntermediateSnapshotNode(CompiledNode): | |
class SnapshotNode(CompiledNode): | ||
resource_type: NodeType = field(metadata={"restrict": [NodeType.Snapshot]}) | ||
config: SnapshotConfig | ||
state_relation: Optional[RelationalNode] = None | ||
|
||
|
||
# ==================================== | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -93,6 +93,7 @@ | |
"version", | ||
"latest_version", | ||
"constraints", | ||
"state_relation", | ||
} | ||
) | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's confusing to use Node in the name here. It's not a Node. These classes are already complicated enough, I don't think it's necessarily a good idea to reuse the existing classes in nodes.py. You're actually reimplementing a Relation class. Do you actually need the separate database/schema/identifier? ("identifier" is what it's actually called in the Relation classes, and makes more sent to me, at least.). I'm not exactly sure how this is going to be used. Would a relation_name (clone_relation_name?) field work?