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

No transact bug #1178

Merged
merged 3 commits into from
Nov 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/spyglass/utils/dj_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,10 @@ def _nwb_table_tuple(self) -> tuple:

Used to determine fetch_nwb behavior. Also used in Merge.fetch_nwb.
Implemented as a cached_property to avoid circular imports."""
from spyglass.common.common_nwbfile import ( # noqa F401
from spyglass.common.common_nwbfile import (
AnalysisNwbfile,
Nwbfile,
)
) # noqa F401

table_dict = {
AnalysisNwbfile: "analysis_file_abs_path",
Expand Down Expand Up @@ -519,11 +519,12 @@ def _hash_upstream(self, keys):
List of keys for populating table.
"""
RestrGraph = self._graph_deps[1]

if not (parents := self.parents(as_objects=True, primary=True)):
# Should not happen, as this is only called from populated tables
raise RuntimeError("No upstream tables found for upstream hash.")

if isinstance(keys, dict):
keys = [keys] # case for single population key
leaves = { # Restriction on each primary parent
p.full_table_name: [
{k: v for k, v in key.items() if k in p.heading.names}
Expand All @@ -550,7 +551,7 @@ def populate(self, *restrictions, **kwargs):
processes = kwargs.pop("processes", 1)

# Decide if using transaction protection
use_transact = kwargs.pop("use_transation", None)
use_transact = kwargs.pop("use_transaction", None)
if use_transact is None: # if user does not specify, use class default
use_transact = self._use_transaction
if self._use_transaction is False: # If class default is off, warn
Expand Down
Loading