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

[Bug]: get_or_create should not update metadata if it exists #478

Closed
jeffchuber opened this issue May 8, 2023 · 4 comments · Fixed by #1402
Closed

[Bug]: get_or_create should not update metadata if it exists #478

jeffchuber opened this issue May 8, 2023 · 4 comments · Fixed by #1402
Assignees
Labels
bug Something isn't working

Comments

@jeffchuber
Copy link
Contributor

What happened?

This is unintuitive behaivor

Versions

All

Relevant log output

No response

@jeffchuber jeffchuber added the bug Something isn't working label May 8, 2023
@HammadB
Copy link
Collaborator

HammadB commented May 8, 2023

To clarify - we aren't sure how to solve this problem - its just a bit confusing that get_or_create can silently update the metadata

@Satyam-79
Copy link
Contributor

The issue is in the logic

if len(dupe_check) > 0:
if get_or_create is True:
if dupe_check[0][2] != metadata:
self.update_collection(name, new_name=name, new_metadata=metadata)
dupe_check = self.get_collection(name)

The get_or_create_collection() function's logic is ambiguous because it updates the metadata of a collection if there is a change in the metadata. The function should be reviewed to ensure it only performs the intended behavior of creating or retrieving collection .

@jeffchuber
Copy link
Contributor Author

FWIW - it appears we have maintained this logic in the refactor

self._modify(id=existing[0]["id"], new_metadata=metadata)

@jeffchuber
Copy link
Contributor Author

we want to update the docstrings to at least be more clear about this behavior

HammadB added a commit that referenced this issue Nov 16, 2023
@HammadB HammadB mentioned this issue Nov 16, 2023
1 task
HammadB added a commit that referenced this issue Nov 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants