Skip to content
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

[CT-2544] Add "other" relation attribute to reffable node classes #7550

Closed
Tracked by #7301
stu-k opened this issue May 8, 2023 · 0 comments · Fixed by #7645
Closed
Tracked by #7301

[CT-2544] Add "other" relation attribute to reffable node classes #7550

stu-k opened this issue May 8, 2023 · 0 comments · Fixed by #7645
Assignees

Comments

@stu-k
Copy link
Contributor

stu-k commented May 8, 2023

Description

As part of the work for clone #7256, reffable nodes need to hold a reference to their "other" counterparts in other schemas.

Jeremy already has a draft PR up that accomplishes this and uses the name "state_relation" as seen in the links below, however we are not beholden to this name.

As always, the language team has the final say in all things artifacts so make sure to get their sign off on whatever approach is taken.

Dependencies

Adapter work from #7549 will be dependent on the work in this ticket.

Acceptance Criteria

  • The reffable node classes (i.e. ModelNode, SeedNode, and SnapshotNode) have a field that stores a relation to an "other" counterpart in another schema
  • This new attribute is not written to manifest.json
  • This new attribute is somehow tested

Links from the draft PR

Separating RelationalNode from ParsedNodeMandatory:

@dataclass
class RelationalNode(HasRelationMetadata):
alias: str
@property
def identifier(self):
return self.alias
@dataclass
class ParsedNodeMandatory(GraphNode, RelationalNode, Replaceable):
checksum: FileHash
config: NodeConfig = field(default_factory=NodeConfig)

Adding a relation to a reffable node:

@dataclass
class ModelNode(CompiledNode):
resource_type: NodeType = field(metadata={"restrict": [NodeType.Model]})
access: AccessType = AccessType.Protected
state_relation: Optional[RelationalNode] = None

Serializing the new relation attribute out of manifest writing:

def __post_serialize__(self, dct):
for unique_id, node in dct["nodes"].items():
if "config_call_dict" in node:
del node["config_call_dict"]
if "state_relation" in node:
del node["state_relation"]
return dct

Adding the new relation attribute to required node keys for manifest tests:

"state_relation",
}

@github-actions github-actions bot changed the title Add relation attribute to reffable node classes [CT-2544] Add relation attribute to reffable node classes May 8, 2023
@stu-k stu-k changed the title [CT-2544] Add relation attribute to reffable node classes [CT-2544] Add "other" relation attribute to reffable node classes May 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant