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

Error when deleting annotation project after deleting a dataset #27

Open
nilomr opened this issue Jul 22, 2024 · 0 comments
Open

Error when deleting annotation project after deleting a dataset #27

nilomr opened this issue Jul 22, 2024 · 0 comments

Comments

@nilomr
Copy link

nilomr commented Jul 22, 2024

Hi Santiago, thanks for your amazing work here!
I'm having a play around with whombat and reporting this minor bug in case it's useful:

Description

When attempting to delete an annotation project corresponding to a dataset that has already been deleted, an error occurs. The deletion process fails with a TypeError when pathlib.Path gets a None value where it expects a path-like object.

Steps to Reproduce

  1. Create a dataset and an annotation project associated with it.
  2. Delete the dataset.
  3. Attempt to delete the annotation project.

(Minimised) Traceback

ERROR: Exception in ASGI application
...
File ".../whombat/routes/annotation_projects.py", line 119, in delete_annotation_project
  project = await api.annotation_projects.delete(session, annotation_project)
...
File ".../whombat/api/common/utils.py", line 535, in delete_object
  await session.delete(obj)
...
File ".../sqlalchemy/orm/relationships.py", line 1482, in _value_as_iterable
  x = impl.get(state, dict_, passive=passive)
...
File ".../sqlalchemy/orm/loading.py", line 705, in load_on_pk_identity
  return result.one()
...
File ".../sqlalchemy/engine/result.py", line 541, in _raw_all_rows
  return [make_row(row) for row in rows]
...
File ".../whombat/models/base.py", line 33, in process_result_value
  return Path(value)
...
File ".../pathlib.py", line 871, in __new__
  self = cls._from_parts(args)
...
TypeError: expected str, bytes or os.PathLike object, not NoneType

Possible Cause

The error occurs in the process_result_value method of the custom SQLAlchemy type defined in whombat/models/base.py, L32. I'm guessing that when trying to process a path value from the now deleted database, it receives None instead of a valid path string.

Suggested Fix?

Do null checking in the process_result_value method or make sure that dataset deletion properly updates or nullifies any dependent paths in annotation projects.

Environment

  • Whombat version: 0.5.1, installed via pip
  • Python version: 3.11
  • Operating System: Ubuntu 22.10
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

No branches or pull requests

1 participant