[英]Datajoint autopopulate make function error: DataJointError: A relation must have primary dependencies for auto-populate to work
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. “DataJointError:关系必须具有主要依赖项才能自动填充工作”,我认为这是一个非常基本的开始,首先定义一个手动表,然后是一个导入的表。
In this case, we have a manual table of matlab filenames from within a folder.在这种情况下,我们有一个文件夹中 matlab 文件名的手动表。 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.
但是,在尝试如下填充时出现以下错误: DataJointError:关系必须具有主要依赖项才能自动填充才能在尝试实现 make function 时起作用。
The upstream Session table has primary key "filename", and we want the imported table to be defined starting like:上游 Session 表具有主键“文件名”,我们希望导入的表定义为:
@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!我试过关闭jupyter笔记本并重新打开,重新启动kernel等。提前感谢您的帮助!
This has been reported in https://github.com/datajoint/datajoint-python/issues/902 and will be addressed shortly.这已在https://github.com/datajoint/datajoint-python/issues/902中报告,并将很快得到解决。 This is caused by the fact that dependencies are not loaded into memory before the populate.
这是因为在填充之前依赖项没有加载到 memory 中。 The intermediate fix is to plot the schema diagram before calling
populate
-- this will load the dependencies and make populate
work correctly.中间修复是在调用
populate
之前对 plot 架构图进行修复——这将加载依赖项并使populate
正常工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.