Open adscib opened 1 year ago
Yes, I tried to make it easier to override File class for a custom logic. But you need to specify upload_type
when declaring your FileField.
Column(FileField(upload_type=MyCustomFileClass))
I can add an option to disable/enable the changes tracking. But this can lead to inconsistencies between your database and your object storage.
Indeed, I can subclass File and that works very well. I would also like to subclass StorageManager, but I don't see a way to update event hooks to use that subclass instead, so I was thinking if there was an option not to register them automatically, I could do that manually with my subclass instead.
I played around with the library a bit and found that I can customize different behaviors by subclassing the sqlalchemy-file classes. I can do it without modifying the library code at all, the only thing that trips me is the global setup for event hooks. Is there any chance there could be an option to disable this global setup, or at least remove the hooks after loading the module? It would make the library quite a bit more flexible. In particular, #54 could be implemented externally. I'm not sure what's the right mechanism for that that's backwards compatible, though.