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

add test and changes for a relationship identifier migration #5652

Merged
merged 6 commits into from
Feb 4, 2025

Conversation

ajtmccarty
Copy link
Contributor

@ajtmccarty ajtmccarty commented Feb 2, 2025

IFC-1202

add tests for the diff calculation logic when handling an attribute name migration or a relationship identifier migration.

update the diff calculation logic to correctly handle a relationship identifier migration. this required using the relationship's identifier instead of its name for determining uniqueness

@github-actions github-actions bot added the group/backend Issue related to the backend (API Server, Git Agent) label Feb 2, 2025
Copy link

codspeed-hq bot commented Feb 2, 2025

CodSpeed Performance Report

Merging #5652 will not alter performance

Comparing ajtm-01312025-diff-migration-tests (8ebb56a) with stable (08f4269)

Summary

✅ 11 untouched benchmarks

@ajtmccarty ajtmccarty force-pushed the ajtm-01312025-diff-migration-tests branch from 82066c0 to a842562 Compare February 3, 2025 22:32
path_type = (
PathType.RELATIONSHIP_ONE
if relationship_schema.cardinality is RelationshipCardinality.ONE
if relationship.cardinality is RelationshipCardinality.ONE
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we used to have to get the cardinality of a relationship from the schema, but now we save it on the diff

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PathType has a .from_relationship() method that would be a bit cleaner to use.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh nice. updated

relationship_schema = node_schema.get_relationship_or_none(name=relationship_diff.name)
if not relationship_schema and alternate_node_schema:
relationship_schema = alternate_node_schema.get_relationship_or_none(name=relationship_diff.name)
relationship_diff.label = relationship_schema.label or "" if relationship_schema else ""
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these changes are required to handle the case when a relationship name is updated

possible_path_directions = database_path.possible_relationship_directions
for rel_schema in relationship_schemas:
if rel_schema.direction in possible_path_directions:
return rel_schema
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have to use both the relationship name and identifier for uniqueness because...

  • an identifier is not unique if the schema has two different relationships for inbound/outbound with the same identifier, like in the case of parent and children in a hierarchy
  • a name is not unique if the relationship has been renamed

@ajtmccarty ajtmccarty marked this pull request as ready for review February 3, 2025 22:45
@ajtmccarty ajtmccarty requested a review from a team February 3, 2025 22:45
Copy link
Contributor

@ogenstad ogenstad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a minor comment as well as a question about the SDK commit.

path_type = (
PathType.RELATIONSHIP_ONE
if relationship_schema.cardinality is RelationshipCardinality.ONE
if relationship.cardinality is RelationshipCardinality.ONE
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PathType has a .from_relationship() method that would be a bit cleaner to use.

python_sdk Outdated
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was the update of the python_sdk commit intentional or by accident?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

accidental. will revert it

@ajtmccarty ajtmccarty force-pushed the ajtm-01312025-diff-migration-tests branch from 1b7aa6b to 8ebb56a Compare February 4, 2025 15:30
@ajtmccarty ajtmccarty merged commit fb0bdc2 into stable Feb 4, 2025
33 checks passed
@ajtmccarty ajtmccarty deleted the ajtm-01312025-diff-migration-tests branch February 4, 2025 15:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
group/backend Issue related to the backend (API Server, Git Agent)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants