Repository navigation
Conversation
…esn't create one #186 added SessionBlockTrial as a top-level dj.Imported class, which DataJoint resolves to `_session_block_trial`. The table in the database is the part table `_session_block__trial` (a dj.Part in U19-pipeline-matlab), so importing u19_pipeline.acquisition tried to declare a new one. Define it as the part SessionBlock.Trial, and point TowersBlock.Trial at it. Assisted-by: ClaudeCode:claude-opus-5-5
…Session #186 added stimulus_set to acquisition.Session, but the live u19_acquisition.session table has no such column and MATLAB never fills it. Reads were unaffected, because DataJoint takes an existing table's heading from the database; the definition was just wrong. behavior.TowersSession's stimulus_set is a real column and stays. Add DB-free tests for both. Assisted-by: ClaudeCode:claude-sonnet-5-5
tabedzki
force-pushed
the
tabedzki/fix/session-block-trial-part
branch
from
November 25, 2026 16:22
7d37e32 to
d5dfc91
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 AI text below 🤖
Fixes #217
Problem
#186 added
SessionBlockTrialas a top-leveldj.Importedclass. DataJoint resolves that to_session_block_trial, which isn't in the database, so importingu19_pipeline.acquisitiontried to create it. With a SELECT-only account the error is swallowed; with an account that can create tables, any import would leave an empty stray table.Comparison
SessionBlockdj.ImportedSessionBlockTrial,dj.Part_session_block__trial_session_block_session_block__trialdj.ImportedSessionBlockTrial,dj.Imported_session_block_trial(doesn't exist)dj.ImportedSessionBlock.Trial,dj.Part_session_block__trialBoth tables stay defined in Python:
_towers_blockhas a foreign key to_session_block, and_towers_block__trialhas one to_session_block__trial.Fix
Evidence
1b3512ee):pytest tests/test_table_definitions.py→ 3 failed, 1 passed ('_session_block_trial' == '_session_block__trial').uvx prek run --all-filespasses.CREATE TABLE ... _session_block_trial. After, it issues no write, and all four tables resolve to existing ones.The new tests need no database. They import the table modules with unactivated schemas.
Merge Danger
Door: two-way
Blast Radius: low. Nothing else in the repo used
SessionBlockTrial. No table in the database changes.Second fix:
Session.stimulus_set#186 also added
stimulus_set : tinyinttoacquisition.Session. The liveu19_acquisition.sessiontable has no such column, Python did not declare it before #186, and MATLAB'sSession.mdeclares it but its insert code never sets it. Reads were unaffected (DataJoint takes an existing table's heading from the database; a fetch on21cad340works). This PR removes that one line.behavior.TowersSession.stimulus_setis a real column and is unchanged. All other columns in the tables #186 and this PR touched were compared with the live schema; names, types, keys and parent tables match. The database's nullableDEFAULT 0columns (main_level,trial_duration_median,is_bad_block) can't be expressed exactly in DataJoint and stay as they are, matching MATLAB.21cad340): the newtest_session_does_not_declare_stimulus_setfails (stimulus_setfound inSession.definition); the other 5 tests intests/test_table_definitions.pypass.d5dfc919): 6 passed in that file. Full suite: 782 passed, 7 skipped.uvx prek run --all-filespasses.Assisted-by: ClaudeCode:claude-opus-5-5
Assisted-by: ClaudeCode:claude-sonnet-5-5