无法重新填充 ElectrodeGroup 数据接头 table
Cannot repopulate ElectrodeGroup datajoint table
我是加州大学旧金山分校 Loren Frank 实验室的研究员,使用数据联合和 nwb 格式的文件。我对 ElectrodeGroup table 中定义条目的代码进行了一些更改,并希望通过删除 table 中的条目并使用新代码重新生成它来测试这些代码。我能够删除该条目,但无法重新填充它。特别是,当我 运行 ElectrodeGroup.populate() 或 ElectrodeGroup.populate({"nwb_file_name": my_file_name}) 时,不会对 table.我确认我删除并尝试重新生成的电极组是在原始 nwb 文件中定义的。我正在寻求关于为什么 populate 命令似乎在这里不起作用的意见。在此先感谢您的帮助!
该用户还通过其他渠道联系了我们的团队。参考 this schema,为未来的用户分享以下解决方案。简而言之,填充过程是为唯一的上游主键保留的。
Since the ElectrodeGroup's only upstream table dependency is Session, the make method will only be called if there are no electrode groups for that session. This is because from the perspective of DataJoint, the only 'guaranteed' knowledge about what should exist for this table is defined solely by the presence/absence of related upstream records. Since the 'new' primary 'electrode_group_name' attribute is defined by the ElectrodeGroup table itself, DataJoint doesn't know how many copies will be created by make, and so simply invokes make 1 time per Session, expecting the single make invocation to fully define all possible electrode_group_name values the table will use. If there is one value for that session, no work needs to be done, so no make() invocation occurs.
There are a couple possible solutions:
- Model the electrode group explicitly, with a table defines the existence of an electrode group (e.g., ElectrodeGroupConfiguration). This ElectrodeGroup would then inherit primary keys from both Session and ElectrodeGroupConfiguration. The ElectrodeGroup make function would be adjusted to load that unique keys across upstream tables.
- Adjust the make function to handle the partial insert/update case, and call the make function directly with the desired primary key when these kinds of 'abnormal' updates need to occur.
Method #1 is 'cleanest' w/r/t to the DataJoint data model (explicitly modeled data dependencies using make/populate), whereas #2 is slightly 'escaping' the DataJoint data model in a controlled way to achieve a desired schema/data result.
我是加州大学旧金山分校 Loren Frank 实验室的研究员,使用数据联合和 nwb 格式的文件。我对 ElectrodeGroup table 中定义条目的代码进行了一些更改,并希望通过删除 table 中的条目并使用新代码重新生成它来测试这些代码。我能够删除该条目,但无法重新填充它。特别是,当我 运行 ElectrodeGroup.populate() 或 ElectrodeGroup.populate({"nwb_file_name": my_file_name}) 时,不会对 table.我确认我删除并尝试重新生成的电极组是在原始 nwb 文件中定义的。我正在寻求关于为什么 populate 命令似乎在这里不起作用的意见。在此先感谢您的帮助!
该用户还通过其他渠道联系了我们的团队。参考 this schema,为未来的用户分享以下解决方案。简而言之,填充过程是为唯一的上游主键保留的。
Since the ElectrodeGroup's only upstream table dependency is Session, the make method will only be called if there are no electrode groups for that session. This is because from the perspective of DataJoint, the only 'guaranteed' knowledge about what should exist for this table is defined solely by the presence/absence of related upstream records. Since the 'new' primary 'electrode_group_name' attribute is defined by the ElectrodeGroup table itself, DataJoint doesn't know how many copies will be created by make, and so simply invokes make 1 time per Session, expecting the single make invocation to fully define all possible electrode_group_name values the table will use. If there is one value for that session, no work needs to be done, so no make() invocation occurs.
There are a couple possible solutions:
- Model the electrode group explicitly, with a table defines the existence of an electrode group (e.g., ElectrodeGroupConfiguration). This ElectrodeGroup would then inherit primary keys from both Session and ElectrodeGroupConfiguration. The ElectrodeGroup make function would be adjusted to load that unique keys across upstream tables.
- Adjust the make function to handle the partial insert/update case, and call the make function directly with the desired primary key when these kinds of 'abnormal' updates need to occur.
Method #1 is 'cleanest' w/r/t to the DataJoint data model (explicitly modeled data dependencies using make/populate), whereas #2 is slightly 'escaping' the DataJoint data model in a controlled way to achieve a desired schema/data result.