0

I have created a dj.AttributeAdapter subclass for a custom datatype (attribute_type = filepath@external). However it does not seem to be working right -- when I attempt to drop the table for instance I get the very cryptic AssertionError: Declaration context is not set. But I declared the context in the schema as schema = dj.schema('myschema', context=locals()). What does this mean? Also, when I use delete it deletes the entry but not the file itself, how do I configure AttributeAdapter to pass this down?

zagaroo
  • 31
  • 4
  • Looking at the source code for this assertion error, your context is registering as `None`. It also looks like datajoint is trying to initialize from an existing database table. https://github.com/datajoint/datajoint-python/blob/master/datajoint/heading.py#L318 – Chris Broz Jan 03 '23 at 15:36

1 Answers1

0

This error occurs when the context is registering as None, initializing from an existing table.

Unfortunately, the DataJoint AttributeAdapter class does not yet support delete calls. One could request this feature by submitting an issue. As it stands, I would suggest using the put method to overwrite existing files and/or implementing an Imported table that checked all files against existing keys and removed additional files.

Chris Broz
  • 136
  • 8