Skip to content

Commit

Permalink
avoid erroring on _update_instance_record
Browse files Browse the repository at this point in the history
  • Loading branch information
Koncopd committed Dec 18, 2024
1 parent 079cf23 commit 78bb253
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lamindb_setup/core/_hub_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,9 @@ def _delete_instance(
)
root_string = storage_record["root"]
# gate storage and instance deletion on empty storage location for
# normally auth.get_session() doesn't have access_token
# so this block is useless i think (Sergei)
# the token is received from user settings inside create_path
if client.auth.get_session() is not None:
access_token = client.auth.get_session().access_token
else:
Expand All @@ -251,7 +254,13 @@ def _delete_instance(
check_storage_is_empty(
root_path, account_for_sqlite_file=account_for_sqlite_file
)
_update_instance_record(instance_with_storage["id"], {"storage_id": None}, client)
# remove this code block after migrtion, i.e. deleting 'storage_id' column of 'instance'
try:
_update_instance_record(
instance_with_storage["id"], {"storage_id": None}, client
)
except APIError:
pass

Check warning on line 263 in lamindb_setup/core/_hub_core.py

View check run for this annotation

Codecov / codecov/patch

lamindb_setup/core/_hub_core.py#L263

Added line #L263 was not covered by tests
# first delete the storage records because we will turn instance_id on
# storage into a FK soon
for storage_record in storage_records:
Expand Down

0 comments on commit 78bb253

Please sign in to comment.