Skip to content

Update error in _resolve_external_table #1535

@samuelbray32

Description

@samuelbray32

Issue

  • _resolve_external_table attempts to update on the restricted external table here
  • Update needs to be applied to the unrestricted original table. as is, calls raise the following error:
---------------------------------------------------------------------------
DataJointError                            Traceback (most recent call last)
Cell In[2], line 4
      2 name = "RS3820250521_.nwb"
      3 path = f"/stelmo/nwb/raw/{name}"
----> 4 _resolve_external_table(path, name, "raw")

File ~/Documents/spyglass_dev/spyglass/src/spyglass/utils/dj_helper_fn.py:526, in _resolve_external_table(filepath, file_name, location)
    524 key = to_update.fetch1()
    525 key.update(update_vals)
--> 526 to_update.update1(key)

File ~/mambaforge-pypy3/envs/spyglass-dev/lib/python3.10/site-packages/datajoint/table.py:325, in Table.update1(self, row)
    323     pass  # ok
    324 if len(self.restriction):
--> 325     raise DataJointError("Update cannot be applied to a restricted table.")
    326 key = {k: row[k] for k in self.primary_key}
    327 if len(self & key) != 1:

DataJointError: Update cannot be applied to a restricted table.

Solution
Track a list of the unrestricted tables that need updated and call update on those

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions