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

'TableChain' object has no attribute 'join' #981

Closed
xlsun79 opened this issue May 20, 2024 · 1 comment · Fixed by #982
Closed

'TableChain' object has no attribute 'join' #981

xlsun79 opened this issue May 20, 2024 · 1 comment · Fixed by #982
Assignees

Comments

@xlsun79
Copy link
Contributor

xlsun79 commented May 20, 2024

Describe the bug
When trying cautious delete with the TrodesPosV1 table, it reported a "'TableChain' object has no attribute 'join'" error. I couldn't find a join method in the TableChain class, so was wondering if this is a general problem of how TableChain was defined in dj_graph.py. How could I fix this?
To Reproduce

import spyglass.position as sgp
(sgp.v1.TrodesPosV1()&{'nwb_file_name':'BraveLu20240513_.nwb'}).cautious_delete()

Error Stack
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In [20], line 2
      1 ###### Delete the position tables if they were incorrect.
----> 2 (sgp.v1.TrodesPosV1()&{'nwb_file_name':nwb_copy_file_name}).delete()

File ~/code/spyglass/src/spyglass/utils/dj_mixin.py:649, in SpyglassMixin.delete(self, force_permission, *args, **kwargs)
    647 def delete(self, force_permission=False, *args, **kwargs):
    648     """Alias for cautious_delete, overwrites datajoint.table.Table.delete"""
--> 649     self.cautious_delete(force_permission=force_permission, *args, **kwargs)

File ~/code/spyglass/src/spyglass/utils/dj_mixin.py:610, in SpyglassMixin.cautious_delete(self, force_permission, *args, **kwargs)
    607 start = time()
    609 if not force_permission:
--> 610     self._check_delete_permission()
    612 merge_deletes = self.delete_downstream_merge(
    613     dry_run=True,
    614     disable_warning=True,
    615     return_parts=False,
    616 )
    618 safemode = (
    619     dj.config.get("safemode", True)
    620     if kwargs.get("safemode") is None
    621     else kwargs["safemode"]
    622 )

File ~/code/spyglass/src/spyglass/utils/dj_mixin.py:534, in SpyglassMixin._check_delete_permission(self)
    527     logger.warn(  # Permit delete if no session connection
    528         "Could not find lab team associated with "
    529         + f"{self.__class__.__name__}."
    530         + "\nBe careful not to delete others' data."
    531     )
    532     return
--> 534 sess_summary = self._get_exp_summary()
    535 experimenters = sess_summary.fetch(self._member_pk)
    536 if None in experimenters:

File ~/code/spyglass/src/spyglass/utils/dj_mixin.py:479, in SpyglassMixin._get_exp_summary(self)
    476 format = dj.U(self._session_pk, self._member_pk)
    478 restr = self.restriction or True
--> 479 sess_link = self._session_connection.join(restr, reverse_order=True)
    481 exp_missing = format & (sess_link - SesExp).proj(**empty_pk)
    482 exp_present = format & (sess_link * SesExp - exp_missing).proj()

AttributeError: 'TableChain' object has no attribute 'join'
@CBroz1 CBroz1 self-assigned this May 20, 2024
@CBroz1
Copy link
Member

CBroz1 commented May 20, 2024

My mistake! This is a holdover from the old version of TableChain, which uses cascade now. I'll fix shortly

CBroz1 added a commit to CBroz1/spyglass that referenced this issue May 20, 2024
@edeno edeno linked a pull request May 20, 2024 that will close this issue
6 tasks
edeno pushed a commit that referenced this issue May 20, 2024
* #981:  ->

* Update changelog
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

Successfully merging a pull request may close this issue.

2 participants