-
Notifications
You must be signed in to change notification settings - Fork 187
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
Multiple RETURN links import now possible #3354
Multiple RETURN links import now possible #3354
Conversation
So if I understand correctly, the only real change was that the if-condition was comparing to Unfortunately, looking at the current code, there are a lot of problems that really should be addressed sooner rather than later. The whole point of #1762 was to get to a state where we know what we export and import, but seeing this code I am afraid we do not actually have much of an idea. But I agree that we cannot tackle that right now. So for me also fine to merge this now |
This is correct.
Yeah, I have been trying slowly to take out each step of the export and import functions, where possible, trying to create backend-agnostic utility functions. This should hopefully make each step of the process easier to deal with and understand, however, it is taking forever to do. |
I understand and already your work has made the organization of the code and the code itself a lot better, but eventually small steps won't solve this particular problem. At some point we will have to face the music and properly design an interface for export/import that matches ORM implementation but that allows for efficient bulk inserts. This is a big challenge, but is the only way to once and for all fix it. |
I completely agree. |
154a3dc
to
7e971be
Compare
@sphuber @giovannipizzi this is ready for review. I have re-implemented the It is not the fastest, nor is it the prettiest fix, but it should be more rigorous in testing the created Links from import. |
7e971be
to
b6ce2b0
Compare
b6ce2b0
to
a8fc655
Compare
I got insecure whether the ad hoc rules would actually work, feeling there is something missed between the usage of However, when writing the test, I came to the realization that there would never be a situation where this is a possible case, due to a combination of the fixed Link rule to follow
cannot be exported, following an export of
with the same Node UUIDS, since they must be sealed - which means the Link between |
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.
One more thing to fix and then this is good to go
) | ||
) | ||
|
||
# New link | ||
links_to_store.append( |
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.
The link checking itself now seems correct, very nice. There is just one thing we realized. In this logic we should not rely on export logic, i.e. what export can legally export. So for example, we should not assume that the contents of an archive are necessarily consistent. This means we have to check that the links within an archive are also consistent. To do this, we simply have to update the existing_
sets at this point. Then in the next iterations, the added link will be included in the existence check and if the archive itself contains duplicate links, it will be noticed.
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.
Done. I have done the same for the SQLAlchemy backend, however, the only way to do this was to not "bulk create" the Links after the for loop, but instead add the new Link in every run using session.add(Link)
.
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.
Btw, also for the SQLAlchemy import, I did a check that the new Links are correctly continuously added and can be found using the QueryBuilder in the subsequent run of the for loop.
a8fc655
to
ab8b6d3
Compare
Thanks a million @CasperWA great stuff ! 👍 |
Fixes #3353