Table with multiple external keys and part tables
Closed this issue · 4 comments
These miss some primary keys identification on the part table side:
Example from:
http://spinevis:3000/forms/boazmohar_imaging/run?subject_id=415099&session=1&fov_id=1
fov_id is part of the primary keys for the master table but it is not greyedout in the part tables:
Run is the master table:
This is one part table:
The fov_id
column of Run.TargetStructure references FOV from the boazmohar_imaging schema, not the master table (Run).
My schema is very simple for it:
Master:
class Run(dj.Manual):
definition = """ # imaging session
-> experiment.Session
-> FOV
---
-> Anesthesia
scan_path : varchar(255) # file path for TIFF stacks
behavior_path ="" : varchar(255) # pupil movies, whisking, locomotion, etc.
craniotomy_notes="" : varchar(4095) # free-text notes
session_notes="" : varchar(4095) # free-text notes
session_ts=CURRENT_TIMESTAMP : timestamp # automatic
"""
Part:
class TargetStructure(dj.Part):
definition = """ # specifies which neuronal structure was imaged
-> Run
-> Compartment
---
"""
I don't think it matters where is the reference coming from.
All primary keys of a Master table should be bound to the part table keys.
Maybe I did something wrong with my schema definition.
We should ping DJ people to see if I did something I shouldn't.
All primary keys of a Master table should be bound to the part table keys.
That is correct. The screenshot you posted illustrates this behavior. As I explained in my last comment, Run.TargetStructure's fov_id
does not reference Run, hence it cannot be bound to it.
It actually doesn't matter what it references.
I will not be able to submit a part table entry if the master keys don't match the master table.
We need to change that logic in Helium as we encounter more convoluted sachems.