datajoint-python
datajoint-python copied to clipboard
`context` required for parent tables having `AttributeAdapter` type
For parent tables with attributes of adapted type, the context is required to find the adapter object. But when declare tables with dj.FreeTable
, context was not provided.
This bug prevents getting key_source
(thus calling .populate()
) on any tables with parents containing adapted type.
Minimal example:
import datajoint as dj
from pipeline import subject
from pipeline.nwb_adapter import nwb_file
schema = dj.schema('test')
@schema
class Session(dj.Manual):
definition = """
-> subject.Subject
session_time: datetime # session time
---
session_note = "" : varchar(256)
nwb_file: <nwb_file> # pynwb.file.NWBFile, filepath
"""
@schema
class SessionNWBFile(dj.Imported):
definition = """
-> Session
---
note: varchar(128)
"""
calling SessionNWBFile.key_source
will result in 'context' not set error
Related https://github.com/datajoint/datajoint-python/issues/687