-
Notifications
You must be signed in to change notification settings - Fork 3
Add versioning support to savable objects #6
Copy link
Copy link
Open
Labels
enhancementNew feature or requestNew feature or request
Description
It would be good to have some support for versions of objects as users may change their classes or change the way that they store the state in the database.
The proposition is as follows:
- Add a
VERSIONclass attribute toSavableObjectandTypeHelperthat is expected to be an integer>= 0 - Encourage users to add a special
_versionkey to their saved state dictionary (if it's not a dict they will have to 'promote' it to one and store the current value within)
Now, when a user gets a state dict in load_instance_state they can interrogate the _version value and have logic that handles the various versions. If they absoloutely cannot handle the version they've been given they can raise a new UnsupportedVersion exception and provide an explanation to the user. This should be discouraged as it's effectively the end of the road for getting the data to be read.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request