I am getting the following error:
"DataJointError: A relation must have primary dependencies for auto-populate to work" with what I think is a very basic start defining first a manual table and then an imported one.
In this case, we have a manual table of matlab filenames from within a folder. We then want to autopopulate an imported table with data from within those files. So there should be a one-to-one match in the dependency between these tables. However, we get the following error when trying to populate as below: DataJointError: A relation must have primary dependencies for auto-populate to work in trying to implement the make function.
The upstream Session table has primary key "filename", and we want the imported table to be defined starting like:
@schema
class Trials(dj.Imported):
definition = """
trial : int
-> Session
---
type = null : int
outcome = null : int
"""
def make(self, key): # key is the primary key of one of the entries in the table `Scan`
name = ((Session & key).fetch1()['filename'])
print(name)
Trials.populate()
I've tried closing the jupyter notebook and re-opening, restarting the kernel, etc. Thanks in advance for any help!
This has been reported in https://github.com/datajoint/datajoint-python/issues/902 and will be addressed shortly. This is caused by the fact that dependencies are not loaded into memory before the populate. The intermediate fix is to plot the schema diagram before calling
populate
-- this will load the dependencies and makepopulate
work correctly.