Cannot drop AttributeAdapter tables -- "Declaration context is not set"

40 views Asked by At

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?

1

There are 1 answers

0
Chris Broz On

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.