Convenience functions to insert / fetch when an attach field is in table definition #1156
Labels
enhancement
Indicates new feature requests
stale
Indicates issues, pull requests, or discussions are inactive
Feature Request
Problem
When inserting into a table that has a field
result : attach@minio
, theinsert
table method expects a file path. Similarly,fetch
stores a file and returns a file path. This is often times inconvenient, because (i) the data saved in the file is required as an object in the python script one is executing, and (ii) the saved / downloaded files remains on local storage even after the script terminated.Requirements
Possible solution: Introduce a parameter to
insert
that automatically saves the data that should be inserted to a file, inserts it into the table, and then removes that file. Similarly,fetch
could save the file, and return the file / data loaded within the python script.Justification
See problem section
Alternative Considerations
Currently I am using an
AttachMixin
as a workaround, i.e. my table would be defined asclass MyTable(AttachMixin, dj.Computed)
. The mixin could be the code basis for the feature I suggested, although it would need a little bit of improvement.Related
This issues might be (loosely) related:
#1109
#1099
If you think such a feature could be helpful to be included in datajoint, I would be happy to help implementing it.
The text was updated successfully, but these errors were encountered: